From 282459f9b8e684502065e3018405ea9ea72c6ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E9=AD=94=E6=85=95=E8=96=87?= Date: Wed, 25 Mar 2020 16:44:12 +0800 Subject: [PATCH] Tecent TCR Provider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Docker image registry. 2. Helm chart registry. Signed-off-by: 疯魔慕薇 Signed-off-by: fanjiankong --- src/go.mod | 1 + src/go.sum | 2 + .../job/impl/replication/replication.go | 2 + src/replication/adapter/tencentcr/adapter.go | 233 ++ .../adapter/tencentcr/adapter_test.go | 303 ++ .../adapter/tencentcr/artifact_registry.go | 181 + .../tencentcr/artifact_registry_test.go | 170 + src/replication/adapter/tencentcr/auth.go | 85 + .../adapter/tencentcr/chart_registry.go | 267 ++ src/replication/adapter/tencentcr/sdk.go | 240 ++ src/replication/adapter/tencentcr/sdk_test.go | 133 + src/replication/model/registry.go | 1 + src/replication/replication.go | 2 + .../tencentcloud/tencentcloud-sdk-go/LICENSE | 201 + .../tencentcloud/common/client.go | 278 ++ .../tencentcloud/common/credentials.go | 58 + .../tencentcloud/common/errors/errors.go | 35 + .../tencentcloud/common/http/request.go | 275 ++ .../tencentcloud/common/http/response.go | 81 + .../common/profile/client_profile.go | 23 + .../common/profile/http_profile.go | 21 + .../tencentcloud/common/regions/regions.go | 58 + .../tencentcloud/common/sign.go | 94 + .../tencentcloud/common/types.go | 95 + .../tencentcloud/tcr/v20190924/client.go | 1519 ++++++++ .../tencentcloud/tcr/v20190924/models.go | 3222 +++++++++++++++++ src/vendor/modules.txt | 8 + 27 files changed, 7588 insertions(+) create mode 100644 src/replication/adapter/tencentcr/adapter.go create mode 100644 src/replication/adapter/tencentcr/adapter_test.go create mode 100644 src/replication/adapter/tencentcr/artifact_registry.go create mode 100644 src/replication/adapter/tencentcr/artifact_registry_test.go create mode 100644 src/replication/adapter/tencentcr/auth.go create mode 100644 src/replication/adapter/tencentcr/chart_registry.go create mode 100644 src/replication/adapter/tencentcr/sdk.go create mode 100644 src/replication/adapter/tencentcr/sdk_test.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/regions/regions.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924/client.go create mode 100644 src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924/models.go diff --git a/src/go.mod b/src/go.mod index ff86cc1bf..822f3dfc5 100644 --- a/src/go.mod +++ b/src/go.mod @@ -65,6 +65,7 @@ require ( github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect github.com/spf13/viper v1.4.0 // indirect github.com/stretchr/testify v1.5.1 + github.com/tencentcloud/tencentcloud-sdk-go v1.0.62 github.com/theupdateframework/notary v0.6.1 golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 golang.org/x/net v0.0.0-20200202094626-16171245cfb2 diff --git a/src/go.sum b/src/go.sum index 5ee045de4..bd31debb1 100644 --- a/src/go.sum +++ b/src/go.sum @@ -739,6 +739,8 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= +github.com/tencentcloud/tencentcloud-sdk-go v1.0.62 h1:Vnr3IqaafEuQUciG6D6EaeLJm26Mg8sjAfbI4OoeauM= +github.com/tencentcloud/tencentcloud-sdk-go v1.0.62/go.mod h1:asUz5BPXxgoPGaRgZaVm1iGcUAuHyYUo1nXqKa83cvI= github.com/theupdateframework/notary v0.6.1 h1:7wshjstgS9x9F5LuB1L5mBI2xNMObWqjz+cjWoom6l0= github.com/theupdateframework/notary v0.6.1/go.mod h1:MOfgIfmox8s7/7fduvB2xyPPMJCrjRLRizA8OFwpnKY= github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= diff --git a/src/jobservice/job/impl/replication/replication.go b/src/jobservice/job/impl/replication/replication.go index c649f4fee..82dc8b8ac 100644 --- a/src/jobservice/job/impl/replication/replication.go +++ b/src/jobservice/job/impl/replication/replication.go @@ -50,6 +50,8 @@ import ( _ "github.com/goharbor/harbor/src/replication/adapter/helmhub" // register the GitLab adapter _ "github.com/goharbor/harbor/src/replication/adapter/gitlab" + // register the TencentCloud TCR adapter + _ "github.com/goharbor/harbor/src/replication/adapter/tencentcr" ) // Replication implements the job interface diff --git a/src/replication/adapter/tencentcr/adapter.go b/src/replication/adapter/tencentcr/adapter.go new file mode 100644 index 000000000..2dd8fca5b --- /dev/null +++ b/src/replication/adapter/tencentcr/adapter.go @@ -0,0 +1,233 @@ +package tencentcr + +import ( + "errors" + "fmt" + "net/http" + "net/url" + "path" + "strings" + + "github.com/docker/distribution/registry/client/auth/challenge" + commonhttp "github.com/goharbor/harbor/src/common/http" + "github.com/goharbor/harbor/src/lib/log" + "github.com/goharbor/harbor/src/pkg/registry/auth/bearer" + adp "github.com/goharbor/harbor/src/replication/adapter" + "github.com/goharbor/harbor/src/replication/adapter/native" + "github.com/goharbor/harbor/src/replication/model" + "github.com/goharbor/harbor/src/replication/util" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/regions" + tcr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924" +) + +var ( + errInvalidTcrEndpoint error = errors.New("[tencent-tcr.newAdapter] Invalid TCR instance endpoint") + errPingTcrEndpointFailed error = errors.New("[tencent-tcr.newAdapter] Ping TCR instance endpoint failed") +) + +func init() { + if err := adp.RegisterFactory(model.RegistryTypeTencentTcr, new(factory)); err != nil { + log.Errorf("failed to register factory for %s: %v", model.RegistryTypeTencentTcr, err) + return + } + log.Infof("the factory for adapter %s registered", model.RegistryTypeTencentTcr) +} + +type factory struct{} + +/** + * Implement Factory Interface +**/ +var _ adp.Factory = &factory{} + +// Create ... +func (f *factory) Create(r *model.Registry) (adp.Adapter, error) { + return newAdapter(r) +} + +// AdapterPattern ... +func (f *factory) AdapterPattern() *model.AdapterPattern { + return getAdapterInfo() +} + +func getAdapterInfo() *model.AdapterPattern { + return &model.AdapterPattern{} +} + +type adapter struct { + *native.Adapter + registryID *string + regionName *string + tcrClient *tcr.Client + pageSize *int64 + client *commonhttp.Client + registry *model.Registry +} + +/** + * Implement Adapter Interface +**/ +var _ adp.Adapter = &adapter{} + +func newAdapter(registry *model.Registry) (a *adapter, err error) { + if !isSecretID(registry.Credential.AccessKey) { + err = errors.New("[tencent-tcr.newAdapter] Please use SecretId/SecretKey, NOT docker login Username/Password") + log.Debugf("[tencent-tcr.newAdapter] error=%v", err) + return + } + + // Query TCR instance info via endpoint. + var registryURL *url.URL + registryURL, _ = url.Parse(registry.URL) + + if strings.Index(registryURL.Host, ".tencentcloudcr.com") < 0 { + log.Errorf("[tencent-tcr.newAdapter] errInvalidTcrEndpoint=%v", err) + return nil, errInvalidTcrEndpoint + } + + realm, service, err := ping(registry) + log.Debugf("[tencent-tcr.newAdapter] realm=%s, service=%s error=%v", realm, service, err) + if err != nil { + log.Errorf("[tencent-tcr.newAdapter] ping failed. error=%v", err) + return + } + + // Create TCR API client + var tcrCredential = common.NewCredential(registry.Credential.AccessKey, registry.Credential.AccessSecret) + var cfp = profile.NewClientProfile() + var client *tcr.Client + // temp client used to get TCR instance info + client, err = tcr.NewClient(tcrCredential, regions.Guangzhou, cfp) + if err != nil { + return + } + + var req = tcr.NewDescribeInstancesRequest() + req.AllRegion = common.BoolPtr(true) + req.Filters = []*tcr.Filter{ + { + Name: common.StringPtr("RegistryName"), + Values: []*string{common.StringPtr(strings.ReplaceAll(registryURL.Host, ".tencentcloudcr.com", ""))}, + }, + } + var resp = tcr.NewDescribeInstancesResponse() + resp, err = client.DescribeInstances(req) + if err != nil { + log.Errorf("DescribeInstances error=%s", err.Error()) + return + } + if *resp.Response.TotalCount == 0 { + err = fmt.Errorf("[tencent-tcr.newAdapter] Can not get TCR instance info. RequestId=%s", *resp.Response.RequestId) + return + } + var instanceInfo = resp.Response.Registries[0] + log.Debugf("[tencent-tcr.InstanceInfo] registry.URL=%s, host=%s, PublicDomain=%s, RegionName=%s, RegistryId=%s", + registry.URL, registryURL.Host, *instanceInfo.PublicDomain, *instanceInfo.RegionName, *instanceInfo.RegistryId) + + // rebuild TCR SDK client + client, err = tcr.NewClient(tcrCredential, *instanceInfo.RegionName, cfp) + if err != nil { + return + } + + var credential = NewAuth(instanceInfo.RegistryId, client) + var transport = util.GetHTTPTransport(registry.Insecure) + var authorizer = bearer.NewAuthorizer(realm, service, credential, transport) + + return &adapter{ + registry: registry, + registryID: instanceInfo.RegistryId, + regionName: instanceInfo.RegionName, + tcrClient: client, + pageSize: common.Int64Ptr(20), + client: commonhttp.NewClient( + &http.Client{ + Transport: transport, + }, + credential, + ), + Adapter: native.NewAdapterWithAuthorizer(registry, authorizer), + }, nil +} + +func ping(registry *model.Registry) (string, string, error) { + client := &http.Client{ + Transport: util.GetHTTPTransport(registry.Insecure), + } + + resp, err := client.Get(registry.URL + "/v2/") + log.Debugf("[tencent-tcr.ping] error=%v", err) + if err != nil { + return "", "", err + } + defer resp.Body.Close() + challenges := challenge.ResponseChallenges(resp) + for _, challenge := range challenges { + if challenge.Scheme == "bearer" { + return challenge.Parameters["realm"], challenge.Parameters["service"], nil + } + } + return "", "", fmt.Errorf("[tencent-tcr.ping] bearer auth scheme isn't supported: %v", challenges) +} + +func (a *adapter) Info() (info *model.RegistryInfo, err error) { + info = &model.RegistryInfo{ + Type: model.RegistryTypeTencentTcr, + SupportedResourceTypes: []model.ResourceType{ + model.ResourceTypeImage, + model.ResourceTypeChart, + }, + SupportedResourceFilters: []*model.FilterStyle{ + { + Type: model.FilterTypeName, + Style: model.FilterStyleTypeText, + }, + { + Type: model.FilterTypeTag, + Style: model.FilterStyleTypeText, + }, + }, + SupportedTriggers: []model.TriggerType{ + model.TriggerTypeManual, + model.TriggerTypeScheduled, + }, + } + return +} + +func (a *adapter) PrepareForPush(resources []*model.Resource) (err error) { + log.Debugf("[tencent-tcr.PrepareForPush]") + for _, resource := range resources { + if resource == nil { + return errors.New("the resource cannot be null") + } + if resource.Metadata == nil { + return errors.New("[tencent-tcr.PrepareForPush] the metadata of resource cannot be null") + } + if resource.Metadata.Repository == nil { + return errors.New("[tencent-tcr.PrepareForPush] the namespace of resource cannot be null") + } + if len(resource.Metadata.Repository.Name) == 0 { + return errors.New("[tencent-tcr.PrepareForPush] the name of the namespace cannot be null") + } + var paths = strings.Split(resource.Metadata.Repository.Name, "/") + var namespace = paths[0] + var repository = path.Join(paths[1:]...) + + log.Debugf("[tencent-tcr.PrepareForPush.createPrivateNamespace] namespace=%s", namespace) + err = a.createPrivateNamespace(namespace) + if err != nil { + return + } + log.Debugf("[tencent-tcr.PrepareForPush.createRepository] namespace=%s, repository=%s", namespace, repository) + err = a.createRepository(namespace, repository) + if err != nil { + return + } + return + } + + return +} diff --git a/src/replication/adapter/tencentcr/adapter_test.go b/src/replication/adapter/tencentcr/adapter_test.go new file mode 100644 index 000000000..16a51440d --- /dev/null +++ b/src/replication/adapter/tencentcr/adapter_test.go @@ -0,0 +1,303 @@ +package tencentcr + +import ( + "fmt" + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/goharbor/harbor/src/common/utils/test" + "github.com/goharbor/harbor/src/lib/log" + adp "github.com/goharbor/harbor/src/replication/adapter" + "github.com/goharbor/harbor/src/replication/adapter/native" + "github.com/goharbor/harbor/src/replication/model" + "github.com/stretchr/testify/assert" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" + tcr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924" +) + +var ( + mockAccessKey = "AKIDxxxx" + mockAccessSecret = "xxxxx" + tcrClient *tcr.Client +) + +func setup() { + if ak := os.Getenv("TENCENT_AK"); ak != "" { + log.Info("USE AK from ENV") + mockAccessKey = ak + } + if sk := os.Getenv("TENCENT_SK"); sk != "" { + log.Info("USE SK from ENV") + mockAccessSecret = sk + } + // var tcrCredential = common.NewCredential(mockAccessKey, mockAccessSecret) + // var cfp = profile.NewClientProfile() + + // tcrClient, _ = tcr.NewClient(tcrCredential, regions.Guangzhou, cfp) +} + +func teardown() {} + +func TestMain(m *testing.M) { + setup() + code := m.Run() + teardown() + os.Exit(code) +} + +func TestAdapter_NewAdapter(t *testing.T) { + factory, err := adp.GetFactory("BadName") + assert.Nil(t, factory) + assert.NotNil(t, err) + + factory, err = adp.GetFactory(model.RegistryTypeTencentTcr) + assert.Nil(t, err) + assert.NotNil(t, factory) +} + +func TestAdapter_NewAdapter_NilAKSK(t *testing.T) { + // Nil AK/SK + adapter, err := newAdapter(&model.Registry{ + Type: model.RegistryTypeTencentTcr, + Credential: &model.Credential{}, + }) + assert.NotNil(t, err) + assert.Nil(t, adapter) +} + +func TestAdapter_NewAdapter_InvalidEndpoint(t *testing.T) { + // Invaild endpoint + adapter, err := newAdapter(&model.Registry{ + Type: model.RegistryTypeTencentTcr, + Credential: &model.Credential{ + AccessKey: mockAccessKey, + AccessSecret: mockAccessSecret, + }, + URL: "$$$", + }) + assert.NotNil(t, err) + assert.EqualError(t, err, errInvalidTcrEndpoint.Error()) + assert.Nil(t, adapter) +} + +func TestAdapter_NewAdapter_Pingfailed(t *testing.T) { + // Invaild endpoint + adapter, err := newAdapter(&model.Registry{ + Type: model.RegistryTypeTencentTcr, + Credential: &model.Credential{ + AccessKey: mockAccessKey, + AccessSecret: mockAccessSecret, + }, + URL: "https://.tencentcloudcr.com", + }) + assert.NotNil(t, err) + assert.Nil(t, adapter) +} + +func TestAdapter_NewAdapter_InvalidAKSK(t *testing.T) { + // Error AK/SK + adapter, err := newAdapter(&model.Registry{ + Type: model.RegistryTypeTencentTcr, + Credential: &model.Credential{ + AccessKey: "mockAccessKey", + AccessSecret: "mockAccessSecret", + }, + }) + assert.NotNil(t, err) + assert.Nil(t, adapter) +} + +func TestAdapter_NewAdapter_Ok(t *testing.T) { + adapter, err := newAdapter(&model.Registry{ + Type: model.RegistryTypeTencentTcr, + Credential: &model.Credential{ + AccessKey: mockAccessKey, + AccessSecret: mockAccessSecret, + }, + URL: "https://harbor-community.tencentcloudcr.com", + }) + if sdkerr, ok := err.(*errors.TencentCloudSDKError); ok { + log.Infof("sdk error, error=%v", sdkerr) + return + } + assert.NotNil(t, adapter) + assert.Nil(t, err) + +} + +func TestAdapter_NewAdapter_InsecureOk(t *testing.T) { + adapter, err := newAdapter(&model.Registry{ + Type: model.RegistryTypeTencentTcr, + Credential: &model.Credential{ + AccessKey: mockAccessKey, + AccessSecret: mockAccessSecret, + }, + Insecure: true, + URL: "https://harbor-community.tencentcloudcr.com", + }) + if sdkerr, ok := err.(*errors.TencentCloudSDKError); ok { + log.Infof("sdk error, error=%v", sdkerr) + return + } + assert.NotNil(t, adapter) + assert.Nil(t, err) +} + +func getMockAdapter(t *testing.T, hasCred, health bool) (*adapter, *httptest.Server) { + server := test.NewServer( + &test.RequestHandlerMapping{ + Method: http.MethodGet, + Pattern: "/v2/_catalog", + Handler: func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Write([]byte(` + { + "repositories": [ + "test1" + ] + }`)) + }, + }, + &test.RequestHandlerMapping{ + Method: http.MethodGet, + Pattern: "/v2/{repo}/tags/list", + Handler: func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Write([]byte(` + { + "name": "test1", + "tags": [ + "latest" + ] + }`)) + }, + }, + &test.RequestHandlerMapping{ + Method: http.MethodGet, + Pattern: "/v2/", + Handler: func(w http.ResponseWriter, r *http.Request) { + fmt.Println(r.Method, r.URL) + if health { + w.WriteHeader(http.StatusOK) + } else { + w.WriteHeader(http.StatusBadRequest) + } + }, + }, + &test.RequestHandlerMapping{ + Method: http.MethodGet, + Pattern: "/", + Handler: func(w http.ResponseWriter, r *http.Request) { + fmt.Println(r.Method, r.URL) + w.WriteHeader(http.StatusOK) + }, + }, + &test.RequestHandlerMapping{ + Method: http.MethodPost, + Pattern: "/", + Handler: func(w http.ResponseWriter, r *http.Request) { + fmt.Println(r.Method, r.URL) + if buf, e := ioutil.ReadAll(&io.LimitedReader{R: r.Body, N: 80}); e == nil { + fmt.Println("\t", string(buf)) + } + w.WriteHeader(http.StatusOK) + }, + }, + ) + + registry := &model.Registry{ + Type: model.RegistryTypeAwsEcr, + URL: server.URL, + } + if hasCred { + registry.Credential = &model.Credential{ + AccessKey: "AKIDxxxx", + AccessSecret: "abcdefg", + } + } + return &adapter{ + registry: registry, + Adapter: native.NewAdapter(registry), + }, server +} + +func TestAdapter_Info(t *testing.T) { + tcrAdapter, _ := getMockAdapter(t, true, true) + info, err := tcrAdapter.Info() + assert.Nil(t, err) + assert.NotNil(t, info) +} + +func TestAdapter_PrepareForPush(t *testing.T) { + a, s := getMockAdapter(t, true, true) + defer s.Close() + resources := []*model.Resource{ + { + Type: model.ResourceTypeImage, + Metadata: &model.ResourceMetadata{ + Repository: &model.Repository{ + Name: "busybox", + }, + }, + }, + } + + err := a.PrepareForPush(resources) + assert.NotNil(t, err) +} + +func TestAdapter_PrepareForPush_NilResource(t *testing.T) { + a, s := getMockAdapter(t, true, true) + defer s.Close() + var resources = []*model.Resource{nil} + + err := a.PrepareForPush(resources) + assert.NotNil(t, err) +} + +func TestAdapter_PrepareForPush_NilMeata(t *testing.T) { + a, s := getMockAdapter(t, true, true) + defer s.Close() + resources := []*model.Resource{ + { + Type: model.ResourceTypeImage, + }, + } + + err := a.PrepareForPush(resources) + assert.NotNil(t, err) +} + +func TestAdapter_PrepareForPush_NilRepository(t *testing.T) { + a, s := getMockAdapter(t, true, true) + defer s.Close() + resources := []*model.Resource{ + { + Type: model.ResourceTypeImage, + Metadata: &model.ResourceMetadata{}, + }, + } + + err := a.PrepareForPush(resources) + assert.NotNil(t, err) +} + +func TestAdapter_PrepareForPush_NilRepositoryName(t *testing.T) { + a, s := getMockAdapter(t, true, true) + defer s.Close() + resources := []*model.Resource{ + { + Type: model.ResourceTypeImage, + Metadata: &model.ResourceMetadata{ + Repository: &model.Repository{}, + }, + }, + } + + err := a.PrepareForPush(resources) + assert.NotNil(t, err) +} diff --git a/src/replication/adapter/tencentcr/artifact_registry.go b/src/replication/adapter/tencentcr/artifact_registry.go new file mode 100644 index 000000000..e69f6f38a --- /dev/null +++ b/src/replication/adapter/tencentcr/artifact_registry.go @@ -0,0 +1,181 @@ +package tencentcr + +import ( + "fmt" + "strings" + + "github.com/goharbor/harbor/src/common/utils" + "github.com/goharbor/harbor/src/lib/log" + adp "github.com/goharbor/harbor/src/replication/adapter" + "github.com/goharbor/harbor/src/replication/model" + "github.com/goharbor/harbor/src/replication/util" + tcr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924" +) + +const ( + tcrQPSLimit = 15 +) + +/** + * Implement ArtifactRegistry Interface +**/ +var _ adp.ArtifactRegistry = &adapter{} + +func filterToPatterns(filters []*model.Filter) (namespacePattern, repoPattern, tagsPattern string) { + for _, filter := range filters { + if filter.Type == model.FilterTypeName { + repoPattern = filter.Value.(string) + } + if filter.Type == model.FilterTypeTag { + tagsPattern = filter.Value.(string) + } + } + namespacePattern = strings.Split(repoPattern, "/")[0] + return +} + +func (a *adapter) FetchArtifacts(filters []*model.Filter) (resources []*model.Resource, err error) { + // get filter pattern + var namespacePattern, repoPattern, tagsPattern = filterToPatterns(filters) + log.Debugf("[tencent-tcr.FetchArtifacts] namespacePattern=%s repoPattern=%s tagsPattern=%s", namespacePattern, repoPattern, tagsPattern) + + // 1. list namespaces + var namespaces []string + namespaces, err = a.listCandidateNamespaces(namespacePattern) + if err != nil { + return + } + log.Debugf("[tencent-tcr.FetchArtifacts] namespaces=%v", namespaces) + + // 2. list repos + var filteredRepos []tcr.TcrRepositoryInfo + for _, ns := range namespaces { + var repos []tcr.TcrRepositoryInfo + repos, err = a.listReposByNamespace(ns) + if err != nil { + return + } + log.Debugf("[tencent-tcr.FetchArtifacts] namespace=%s, repositories=%d", ns, len(repos)) + + if _, ok := util.IsSpecificPathComponent(repoPattern); ok { + log.Debugf("[tencent-tcr.FetchArtifacts] specific_repos=%s", repoPattern) + // TODO: Check repo is exist. + filteredRepos = append(filteredRepos, repos...) + } else { + // 3. filter repos + for _, repo := range repos { + var ok bool + ok, err = util.Match(repoPattern, *repo.Name) + log.Debugf("[tencent-tcr.FetchArtifacts] namespace=%s, repository=%s, repoPattern=%s, Match=%v", *repo.Namespace, *repo.Name, repoPattern, ok) + if err != nil { + return + } + if ok { + filteredRepos = append(filteredRepos, repo) + } + } + } + } + log.Debugf("[tencent-tcr.FetchArtifacts] filteredRepos=%d", len(filteredRepos)) + + // 4. list images + var rawResources = make([]*model.Resource, len(filteredRepos)) + runner := utils.NewLimitedConcurrentRunner(tcrQPSLimit) + + for i, r := range filteredRepos { + // !copy + index := i + repo := r + + runner.AddTask(func() error { + var images []string + _, images, err = a.getImages(*repo.Namespace, *repo.Name, "") + if err != nil { + return fmt.Errorf("[tencent-tcr.FetchArtifacts.listImages] repo=%s, error=%v", *repo.Name, err) + } + + var filteredImages []string + if tagsPattern != "" { + for _, image := range images { + var ok bool + ok, err = util.Match(tagsPattern, image) + if err != nil { + return fmt.Errorf("[tencent-tcr.FetchArtifacts.matchImage] image='%s', error=%v", image, err) + } + if ok { + filteredImages = append(filteredImages, image) + } + } + } else { + filteredImages = images + } + + log.Debugf("[tencent-tcr.FetchArtifacts] repo=%s, images=%v, filteredImages=%v", *repo.Name, images, filteredImages) + + if len(filteredImages) > 0 { + rawResources[index] = &model.Resource{ + Type: model.ResourceTypeImage, + Registry: a.registry, + Metadata: &model.ResourceMetadata{ + Repository: &model.Repository{ + Name: *repo.Name, + }, + Vtags: filteredImages, + }, + } + } + + return nil + }) + } + if err = runner.Wait(); err != nil { + return nil, fmt.Errorf("failed to fetch artifacts: %v", err) + } + + for _, res := range rawResources { + if res != nil { + resources = append(resources, res) + } + } + log.Debugf("[tencent-tcr.FetchArtifacts] resources.size=%d", len(resources)) + + return +} + +func (a *adapter) listCandidateNamespaces(namespacePattern string) (namespaces []string, err error) { + // filter namespaces + if len(namespacePattern) > 0 { + if nms, ok := util.IsSpecificPathComponent(namespacePattern); ok { + // Check is exist + var exist bool + for _, ns := range nms { + exist, err = a.isNamespaceExist(ns) + if err != nil { + return + } + if !exist { + continue + } + namespaces = append(namespaces, nms...) + } + } + } + + if len(namespaces) > 0 { + log.Debugf("[tencent-tcr.listCandidateNamespaces] pattern=%s, namespaces=%v", namespacePattern, namespaces) + return namespaces, nil + } + + // list all + return a.listNamespaces() +} + +func (a *adapter) DeleteManifest(repository, reference string) (err error) { + parts := strings.Split(repository, "/") + if len(parts) != 2 { + return fmt.Errorf("tcr only support repo in format /, but got: %s", repository) + } + log.Warningf("[tencent-tcr.DeleteManifest] namespace=%s, repository=%s, tag=%s", parts[0], parts[1], reference) + + return a.deleteImage(parts[0], parts[1], reference) +} diff --git a/src/replication/adapter/tencentcr/artifact_registry_test.go b/src/replication/adapter/tencentcr/artifact_registry_test.go new file mode 100644 index 000000000..07f4f3722 --- /dev/null +++ b/src/replication/adapter/tencentcr/artifact_registry_test.go @@ -0,0 +1,170 @@ +package tencentcr + +import ( + "reflect" + "testing" + + commonhttp "github.com/goharbor/harbor/src/common/http" + "github.com/goharbor/harbor/src/replication/adapter/native" + "github.com/goharbor/harbor/src/replication/model" + tcr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924" +) + +func Test_filterToPatterns(t *testing.T) { + type args struct { + filters []*model.Filter + } + tests := []struct { + name string + args args + wantNamespacePattern string + wantRepoPattern string + wantTagsPattern string + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gotNamespacePattern, gotRepoPattern, gotTagsPattern := filterToPatterns(tt.args.filters) + if gotNamespacePattern != tt.wantNamespacePattern { + t.Errorf("filterToPatterns() gotNamespacePattern = %v, want %v", gotNamespacePattern, tt.wantNamespacePattern) + } + if gotRepoPattern != tt.wantRepoPattern { + t.Errorf("filterToPatterns() gotRepoPattern = %v, want %v", gotRepoPattern, tt.wantRepoPattern) + } + if gotTagsPattern != tt.wantTagsPattern { + t.Errorf("filterToPatterns() gotTagsPattern = %v, want %v", gotTagsPattern, tt.wantTagsPattern) + } + }) + } +} + +func Test_adapter_FetchArtifacts(t *testing.T) { + type fields struct { + Adapter *native.Adapter + registryID *string + regionName *string + tcrClient *tcr.Client + pageSize *int64 + client *commonhttp.Client + registry *model.Registry + } + type args struct { + filters []*model.Filter + } + tests := []struct { + name string + fields fields + args args + wantResources []*model.Resource + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{ + Adapter: tt.fields.Adapter, + registryID: tt.fields.registryID, + regionName: tt.fields.regionName, + tcrClient: tt.fields.tcrClient, + pageSize: tt.fields.pageSize, + client: tt.fields.client, + registry: tt.fields.registry, + } + gotResources, err := a.FetchArtifacts(tt.args.filters) + if (err != nil) != tt.wantErr { + t.Errorf("adapter.FetchArtifacts() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(gotResources, tt.wantResources) { + t.Errorf("adapter.FetchArtifacts() = %v, want %v", gotResources, tt.wantResources) + } + }) + } +} + +func Test_adapter_listCandidateNamespaces(t *testing.T) { + type fields struct { + Adapter *native.Adapter + registryID *string + regionName *string + tcrClient *tcr.Client + pageSize *int64 + client *commonhttp.Client + registry *model.Registry + } + type args struct { + namespacePattern string + } + tests := []struct { + name string + fields fields + args args + wantNamespaces []string + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{ + Adapter: tt.fields.Adapter, + registryID: tt.fields.registryID, + regionName: tt.fields.regionName, + tcrClient: tt.fields.tcrClient, + pageSize: tt.fields.pageSize, + client: tt.fields.client, + registry: tt.fields.registry, + } + gotNamespaces, err := a.listCandidateNamespaces(tt.args.namespacePattern) + if (err != nil) != tt.wantErr { + t.Errorf("adapter.listCandidateNamespaces() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(gotNamespaces, tt.wantNamespaces) { + t.Errorf("adapter.listCandidateNamespaces() = %v, want %v", gotNamespaces, tt.wantNamespaces) + } + }) + } +} + +func Test_adapter_DeleteManifest(t *testing.T) { + type fields struct { + Adapter *native.Adapter + registryID *string + regionName *string + tcrClient *tcr.Client + pageSize *int64 + client *commonhttp.Client + registry *model.Registry + } + type args struct { + repository string + reference string + } + tests := []struct { + name string + fields fields + args args + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{ + Adapter: tt.fields.Adapter, + registryID: tt.fields.registryID, + regionName: tt.fields.regionName, + tcrClient: tt.fields.tcrClient, + pageSize: tt.fields.pageSize, + client: tt.fields.client, + registry: tt.fields.registry, + } + if err := a.DeleteManifest(tt.args.repository, tt.args.reference); (err != nil) != tt.wantErr { + t.Errorf("adapter.DeleteManifest() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/src/replication/adapter/tencentcr/auth.go b/src/replication/adapter/tencentcr/auth.go new file mode 100644 index 000000000..869b4a833 --- /dev/null +++ b/src/replication/adapter/tencentcr/auth.go @@ -0,0 +1,85 @@ +package tencentcr + +import ( + "net/http" + "strings" + "time" + + "github.com/goharbor/harbor/src/common/http/modifier" + "github.com/goharbor/harbor/src/lib/log" + tcr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924" +) + +// Credential ... +type Credential modifier.Modifier + +var _ Credential = &qcloudAuthCredential{} + +func (q *qcloudAuthCredential) Modify(r *http.Request) (err error) { + if !q.isCacheTokenValid() { + err = q.getTempInstanceToken() + log.Debugf("qcloudAuthCredential.Modify.isCacheTokenValid.updateToken=%s, err=%v", q.cacheTokenExpiredAt, err) + if err != nil { + return + } + } + r.SetBasicAuth(q.cacheTokener.username, q.cacheTokener.token) + log.Debugf("[qcloudAuthCredential.Modify]Host: %v, header: %#v", r.Host, r.Header) + return +} + +func (q *qcloudAuthCredential) isCacheTokenValid() (ok bool) { + if &q.cacheTokenExpiredAt == nil { + return + } + if q.cacheTokener == nil { + return + } + if time.Now().After(q.cacheTokenExpiredAt) { + return + } + return true +} + +// Implements interface Credential +type qcloudAuthCredential struct { + registryID *string + client *tcr.Client + cacheTokener *temporaryTokener + cacheTokenExpiredAt time.Time +} + +type temporaryTokener struct { + username string + token string +} + +// NewAuth ... +func NewAuth(registryID *string, client *tcr.Client) Credential { + return &qcloudAuthCredential{ + registryID: registryID, + client: client, + cacheTokener: &temporaryTokener{}, + } +} + +func (q *qcloudAuthCredential) getTempInstanceToken() (err error) { + var req = tcr.NewCreateInstanceTokenRequest() + req.RegistryId = q.registryID + var resp *tcr.CreateInstanceTokenResponse + resp, err = q.client.CreateInstanceToken(req) + if err != nil { + return + } + + q.cacheTokener = &temporaryTokener{*resp.Response.Username, *resp.Response.Token} + q.cacheTokenExpiredAt = time.Unix(*resp.Response.ExpTime/1e3, *resp.Response.ExpTime%1e3) + log.Debugf("[qcloudAuthCredential.getTempInstanceToken]Update temp token=%#v, cacheTokenExpiredAt=%s, unix=%v", q.cacheTokener, + q.cacheTokenExpiredAt.UTC().String(), *resp.Response.ExpTime) + + return +} + +func isSecretID(key string) (ok bool) { + return strings.Index(key, "AKID") == 0 +} diff --git a/src/replication/adapter/tencentcr/chart_registry.go b/src/replication/adapter/tencentcr/chart_registry.go new file mode 100644 index 000000000..6ed7b19bd --- /dev/null +++ b/src/replication/adapter/tencentcr/chart_registry.go @@ -0,0 +1,267 @@ +package tencentcr + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "mime/multipart" + "net/http" + "strings" + + commonhttp "github.com/goharbor/harbor/src/common/http" + "github.com/goharbor/harbor/src/lib/log" + adp "github.com/goharbor/harbor/src/replication/adapter" + "github.com/goharbor/harbor/src/replication/filter" + "github.com/goharbor/harbor/src/replication/model" +) + +const ( + chartListURL = "%s/api/chartrepo/%s/charts" + chartVersionURL = "%s/api/chartrepo/%s/charts/%s" + chartInfoURL = "%s/api/chartrepo/%s/charts/%s/%s" +) + +type tcrChart struct { + APIVersion string `json:"apiVersion"` + Digest string `json:"digest"` + Name string `json:"name"` + URLs []string `json:"urls"` + Version string `json:"version"` +} + +type tcrChartVersionDetail struct { + Metadata *tcrChartVersionMetadata `json:"metadata"` +} +type tcrChartVersionMetadata struct { + URLs []string `json:"urls"` +} + +var _ adp.ChartRegistry = &adapter{} + +func (a *adapter) FetchCharts(filters []*model.Filter) (resources []*model.Resource, err error) { + log.Debugf("[tencent-tcr.FetchCharts]filters: %#v", filters) + // 1. list namespaces + var nsPattern, _, _ = filterToPatterns(filters) + var nms []string + nms, err = a.listCandidateNamespaces(nsPattern) + if err != nil { + return + } + + // 2. list repositories + for _, ns := range nms { + var url = fmt.Sprintf(chartListURL, a.registry.URL, ns) + var repositories = []*model.Repository{} + err = a.client.Get(url, &repositories) + log.Debugf("[tencent-tcr.FetchCharts] url=%s, namespace=%s, repositories=%v, error=%v", url, ns, repositories, err) + if err != nil { + return + } + if len(repositories) == 0 { + continue + } + for _, repository := range repositories { + repository.Name = fmt.Sprintf("%s/%s", ns, repository.Name) + } + repositories, err = filter.DoFilterRepositories(repositories, filters) + if err != nil { + return + } + + // 3. list versions + for _, repository := range repositories { + var name = strings.SplitN(repository.Name, "/", 2)[1] + var url = fmt.Sprintf(chartVersionURL, a.registry.URL, ns, name) + var charts = []*tcrChart{} + err = a.client.Get(url, &charts) + if err != nil { + return nil, err + } + if len(charts) == 0 { + continue + } + var artifacts []*model.Artifact + for _, chart := range charts { + artifacts = append(artifacts, &model.Artifact{ + Tags: []string{chart.Version}, + }) + } + artifacts, err = filter.DoFilterArtifacts(artifacts, filters) + if err != nil { + return nil, err + } + if len(artifacts) == 0 { + continue + } + + for _, artifact := range artifacts { + resources = append(resources, &model.Resource{ + Type: model.ResourceTypeChart, + Registry: a.registry, + Metadata: &model.ResourceMetadata{ + Repository: &model.Repository{ + Name: repository.Name, + }, + Artifacts: []*model.Artifact{artifact}, + }, + }) + } + } + + } + + return +} + +func (a *adapter) ChartExist(name, version string) (exist bool, err error) { + log.Debugf("[tencent-tcr.ChartExist] name=%s version=%s", name, version) + _, err = a.getChartInfo(name, version) + // if not found, return not exist + if httpErr, ok := err.(*commonhttp.Error); ok && httpErr.Code == http.StatusNotFound { + return false, nil + } + if err != nil { + return + } + exist = true + + return +} + +func (a *adapter) getChartInfo(name, version string) (info *tcrChartVersionDetail, err error) { + var namespace string + var chart string + namespace, chart, err = parseChartName(name) + if err != nil { + return + } + + var url = fmt.Sprintf(chartInfoURL, a.registry.URL, namespace, chart, version) + info = &tcrChartVersionDetail{} + err = a.client.Get(url, info) + if err != nil { + return + } + return +} + +func (a *adapter) DownloadChart(name, version string) (rc io.ReadCloser, err error) { + var info *tcrChartVersionDetail + info, err = a.getChartInfo(name, version) + if err != nil { + return + } + if info.Metadata == nil || len(info.Metadata.URLs) == 0 || len(info.Metadata.URLs[0]) == 0 { + return nil, fmt.Errorf("[tencent-tcr.DownloadChart.NO_DOWNLOAD_URL] chart=%s:%s", name, version) + } + + var url = strings.ToLower(info.Metadata.URLs[0]) + // relative URL + if !(strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://")) { + var namespace string + namespace, _, err = parseChartName(name) + if err != nil { + return + } + url = fmt.Sprintf("%s/chartrepo/%s/%s", a.registry.URL, namespace, url) + } + + var req *http.Request + var resp *http.Response + var body []byte + req, err = http.NewRequest(http.MethodGet, url, nil) + if err != nil { + return + } + resp, err = a.client.Do(req) + if err != nil { + return + } + if resp.StatusCode != http.StatusOK { + body, err = ioutil.ReadAll(resp.Body) + if err != nil { + return + } + err = fmt.Errorf("[tencent-tcr.DownloadChart.failed] chart=%s, status=%d, body=%s", req.URL.String(), resp.StatusCode, string(body)) + + return + } + + return resp.Body, nil +} + +func (a *adapter) UploadChart(name, version string, reader io.Reader) (err error) { + var namespace string + var chart string + namespace, chart, err = parseChartName(name) + if err != nil { + return + } + + // 1. write to form-data buffer + var buf = &bytes.Buffer{} + var writer = multipart.NewWriter(buf) + var fw io.Writer + fw, err = writer.CreateFormFile("chart", chart+".tgz") + if err != nil { + return + } + _, err = io.Copy(fw, reader) + if err != nil { + return + } + writer.Close() + + // 2. upload + var url = fmt.Sprintf(chartListURL, a.registry.URL, namespace) + var req *http.Request + var resp *http.Response + req, err = http.NewRequest(http.MethodPost, url, buf) + if err != nil { + return + } + req.Header.Set("Content-Type", writer.FormDataContentType()) + resp, err = a.client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + + // 3. parse response + var data []byte + data, err = ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + if resp.StatusCode < http.StatusOK || resp.StatusCode > 299 { + err = &commonhttp.Error{ + Code: resp.StatusCode, + Message: string(data), + } + return + } + return +} + +func (a *adapter) DeleteChart(name, version string) (err error) { + var namespace string + var chart string + namespace, chart, err = parseChartName(name) + if err != nil { + return + } + + var url = fmt.Sprintf(chartInfoURL, a.registry.URL, namespace, chart, version) + + return a.client.Delete(url) +} + +func parseChartName(name string) (namespace, chart string, err error) { + strs := strings.Split(name, "/") + if len(strs) == 2 && len(strs[0]) > 0 && len(strs[1]) > 0 { + return strs[0], strs[1], nil + } + return "", "", fmt.Errorf("[tencent-tcr.parseChartName.invalid_name] name=%s", name) +} diff --git a/src/replication/adapter/tencentcr/sdk.go b/src/replication/adapter/tencentcr/sdk.go new file mode 100644 index 000000000..889b1b423 --- /dev/null +++ b/src/replication/adapter/tencentcr/sdk.go @@ -0,0 +1,240 @@ +package tencentcr + +import ( + "errors" + "strings" + + "github.com/goharbor/harbor/src/lib/log" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" + tcr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924" +) + +func (a *adapter) createPrivateNamespace(namespace string) (err error) { + if a.tcrClient == nil { + err = errors.New("[tencent-tcr.createPrivateNamespace] nil tcr client") + return + } + + // 1. if exist skip + log.Debugf("[tencent-tcr.PrepareForPush.createPrivateNamespace] namespace=%s", namespace) + var exist bool + exist, err = a.isNamespaceExist(namespace) + if err != nil { + return + } + if exist { + log.Warningf("[tencent-tcr.PrepareForPush.createPrivateNamespace.skip_exist] namespace=%s", namespace) + return + } + + // !!! 2. WARNING: for safety, auto create namespace is private. + var req = tcr.NewCreateNamespaceRequest() + req.NamespaceName = &namespace + req.RegistryId = a.registryID + var isPublic = false + req.IsPublic = &isPublic + tcr.NewCreateNamespaceResponse() + _, err = a.tcrClient.CreateNamespace(req) + if err != nil { + log.Debugf("[tencent-tcr.PrepareForPush.createPrivateNamespace] error=%v", err) + return + } + return +} + +func (a *adapter) createRepository(namespace, repository string) (err error) { + if a.tcrClient == nil { + err = errors.New("[tencent-tcr.createRepository] nil tcr client") + return + } + + // 1. if exist skip + log.Debugf("[tencent-tcr.PrepareForPush.createRepository] namespace=%s, repository=%s", namespace, repository) + var repoReq = tcr.NewDescribeRepositoriesRequest() + repoReq.RegistryId = a.registryID + repoReq.NamespaceName = &namespace + repoReq.RepositoryName = &repository + var repoResp = tcr.NewDescribeRepositoriesResponse() + repoResp, err = a.tcrClient.DescribeRepositories(repoReq) + if err != nil { + return + } + if int(*repoResp.Response.TotalCount) > 0 { + log.Warningf("[tencent-tcr.PrepareForPush.createRepository.skip_exist] namespace=%s, repository=%s", namespace, repository) + return + } + + // 2. create + var req = tcr.NewCreateRepositoryRequest() + req.NamespaceName = &namespace + req.RepositoryName = &repository + req.RegistryId = a.registryID + var resp = tcr.NewCreateRepositoryResponse() + resp, err = a.tcrClient.CreateRepository(req) + if err != nil { + log.Debugf("[tencent-tcr.PrepareForPush.createRepository] error=%v", err) + return + } + log.Debugf("[tencent-tcr.PrepareForPush.createRepository] resp=%#v", *resp) + + return +} + +func (a *adapter) listNamespaces() (namespaces []string, err error) { + if a.tcrClient == nil { + err = errors.New("[tencent-tcr.listNamespaces] nil tcr client") + return + } + + // list namespaces + var req = tcr.NewDescribeNamespacesRequest() + req.RegistryId = a.registryID + req.Limit = a.pageSize + var resp = tcr.NewDescribeNamespacesResponse() + + var page int64 + for { + req.Offset = &page + resp, err = a.tcrClient.DescribeNamespaces(req) + if err != nil { + log.Debugf("[tencent-tcr.DescribeNamespaces] registryID=%s, error=%v", *a.registryID, err) + return + } + + for _, ns := range resp.Response.NamespaceList { + namespaces = append(namespaces, *ns.Name) + } + + if len(namespaces) >= int(*resp.Response.TotalCount) { + break + } + page++ + } + + log.Debugf("[tencent-tcr.FetchArtifacts.listNamespaces] registryID=%s, namespaces[%d]=%s", *a.registryID, len(namespaces), namespaces) + return +} + +func (a *adapter) isNamespaceExist(namespace string) (exist bool, err error) { + if a.tcrClient == nil { + err = errors.New("[tencent-tcr.isNamespaceExist] nil tcr client") + return + } + + var req = tcr.NewDescribeNamespacesRequest() + req.NamespaceName = &namespace + req.RegistryId = a.registryID + var resp = tcr.NewDescribeNamespacesResponse() + resp, err = a.tcrClient.DescribeNamespaces(req) + if err != nil { + return + } + + log.Warningf("[tencent-tcr.PrepareForPush.isNamespaceExist] namespace=%s, total=%d", namespace, *resp.Response.TotalCount) + if int(*resp.Response.TotalCount) != 1 { + return + } + exist = true + return +} + +func (a *adapter) listReposByNamespace(namespace string) (repos []tcr.TcrRepositoryInfo, err error) { + if a.tcrClient == nil { + err = errors.New("[tencent-tcr.listReposByNamespace] nil tcr client") + return + } + + var req = tcr.NewDescribeRepositoriesRequest() + req.RegistryId = a.registryID + req.NamespaceName = common.StringPtr(namespace) + req.Limit = a.pageSize + var resp = tcr.NewDescribeRepositoriesResponse() + + var page int64 + for { + req.Offset = common.Int64Ptr(page) + resp, err = a.tcrClient.DescribeRepositories(req) + if err != nil { + log.Debugf("[tencent-tcr.listReposByNamespace.DescribeRepositories] registryID=%s, namespace=%s, error=%v", *a.registryID, namespace, err) + return + } + + size := len(resp.Response.RepositoryList) + for i, repo := range resp.Response.RepositoryList { + log.Debugf("[tencent-tcr.listReposByNamespace.DescribeRepositories] Retrives page=%d repo(%d/%d)=%s", page, i, size, *repo.Name) + repos = append(repos, *repo) + } + + if len(repos) == int(*resp.Response.TotalCount) { + log.Debugf("[tencent-tcr.listReposByNamespace.DescribeRepositories] Retrives all repos.") + break + } + page++ + } + + log.Debugf("[tencent-tcr.listReposByNamespace] registryID=%s, namespace=%s, repos=%d", + *a.registryID, namespace, len(repos)) + return +} + +func (a *adapter) getImages(namespace, repo, tag string) (images []*tcr.TcrImageInfo, imageNames []string, err error) { + if a.tcrClient == nil { + err = errors.New("[tencent-tcr.getImages] nil tcr client") + return + } + + if namespace != "" { + repo = strings.Replace(repo, namespace, "", 1) + repo = strings.Replace(repo, "/", "", 1) + } + + var req = tcr.NewDescribeImagesRequest() + req.RegistryId = a.registryID + req.NamespaceName = &namespace + req.RepositoryName = &repo + req.Limit = a.pageSize + if tag != "" { + req.ImageVersion = &tag + } + var resp = tcr.NewDescribeImagesResponse() + + var page int64 + for { + log.Debugf("[tencent-tcr.getImages] registryID=%s, namespace=%s, repo=%s, tag=%s, page=%d", + *a.registryID, namespace, repo, tag, page) + req.Offset = &page + resp, err = a.tcrClient.DescribeImages(req) + if err != nil { + log.Debugf("[tencent-tcr.getImages.DescribeImages] registryID=%s, namespace=%s, repo=%s, error=%v", *a.registryID, namespace, repo, err) + return + } + + images = resp.Response.ImageInfoList + for _, image := range resp.Response.ImageInfoList { + imageNames = append(imageNames, *image.ImageVersion) + } + + if len(images) == int(*resp.Response.TotalCount) { + break + } + page++ + } + + log.Debugf("[tencent-tcr.getImages] registryID=%s, namespace=%s, repo=%s, tags[%d]=%v\n", *a.registryID, namespace, repo, len(imageNames), imageNames) + return +} + +func (a *adapter) deleteImage(namespace, repository, reference string) (err error) { + var req = tcr.NewDeleteImageRequest() + req.RegistryId = a.registryID + req.NamespaceName = common.StringPtr(namespace) + req.RepositoryName = common.StringPtr(repository) + req.ImageVersion = common.StringPtr(reference) + + _, err = a.tcrClient.DeleteImage(req) + if err != nil { + log.Errorf("[tencent-tcr.deleteImage.DeleteImage] failed. namespace=%s, repository=%s, tag=%s, error=%s", namespace, repository, reference, err.Error()) + } + + return +} diff --git a/src/replication/adapter/tencentcr/sdk_test.go b/src/replication/adapter/tencentcr/sdk_test.go new file mode 100644 index 000000000..0a492027b --- /dev/null +++ b/src/replication/adapter/tencentcr/sdk_test.go @@ -0,0 +1,133 @@ +package tencentcr + +import ( + "reflect" + "testing" +) + +func Test_adapter_createPrivateNamespace(t *testing.T) { + tests := []struct { + name string + namespace string + wantErr bool + }{ + {namespace: "ut_ns_123", wantErr: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{tcrClient: tcrClient} + if err := a.createPrivateNamespace(tt.namespace); (err != nil) != tt.wantErr { + t.Errorf("adapter.createPrivateNamespace() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func Test_adapter_createRepository(t *testing.T) { + tests := []struct { + name string + namespace string + repository string + wantErr bool + }{ + {namespace: "ut_ns_123", repository: "ut_repo_123", wantErr: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{tcrClient: tcrClient} + if err := a.createRepository(tt.namespace, tt.repository); (err != nil) != tt.wantErr { + t.Errorf("adapter.createRepository() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func Test_adapter_listNamespaces(t *testing.T) { + tests := []struct { + name string + wantNamespaces []string + wantErr bool + }{ + {wantNamespaces: []string{}, wantErr: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{tcrClient: tcrClient} + _, err := a.listNamespaces() + if (err != nil) != tt.wantErr { + t.Errorf("adapter.listNamespaces() error = %v, wantErr %v", err, tt.wantErr) + return + } + }) + } +} + +func Test_adapter_isNamespaceExist(t *testing.T) { + tests := []struct { + name string + namespace string + wantExist bool + wantErr bool + }{ + {namespace: "ut_ns_123", wantErr: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{tcrClient: tcrClient} + gotExist, err := a.isNamespaceExist(tt.namespace) + if (err != nil) != tt.wantErr { + t.Errorf("adapter.isNamespaceExist() error = %v, wantErr %v", err, tt.wantErr) + return + } + if gotExist != tt.wantExist { + t.Errorf("adapter.isNamespaceExist() = %v, want %v", gotExist, tt.wantExist) + } + }) + } +} + +func Test_adapter_listReposByNamespace(t *testing.T) { + tests := []struct { + name string + namespace string + wantErr bool + }{ + {namespace: "ut_ns_123", wantErr: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{tcrClient: tcrClient} + _, err := a.listReposByNamespace(tt.namespace) + if (err != nil) != tt.wantErr { + t.Errorf("adapter.listReposByNamespace() error = %v, wantErr %v", err, tt.wantErr) + return + } + }) + } +} + +func Test_adapter_getImages(t *testing.T) { + tests := []struct { + name string + namespace string + repo string + tag string + wantImages []string + wantErr bool + }{ + {namespace: "ut_ns_123", repo: "ut_repo_123", wantErr: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := &adapter{tcrClient: tcrClient} + _, gotImages, err := a.getImages(tt.namespace, tt.repo, tt.tag) + if (err != nil) != tt.wantErr { + t.Errorf("adapter.getImages() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(gotImages, tt.wantImages) { + t.Errorf("adapter.getImages() = %v, want %v", gotImages, tt.wantImages) + } + }) + } +} diff --git a/src/replication/model/registry.go b/src/replication/model/registry.go index 96cc0d8e5..6408a1102 100644 --- a/src/replication/model/registry.go +++ b/src/replication/model/registry.go @@ -31,6 +31,7 @@ const ( RegistryTypeJfrogArtifactory RegistryType = "jfrog-artifactory" RegistryTypeQuay RegistryType = "quay" RegistryTypeGitLab RegistryType = "gitlab" + RegistryTypeTencentTcr RegistryType = "tencent-tcr" RegistryTypeHelmHub RegistryType = "helm-hub" diff --git a/src/replication/replication.go b/src/replication/replication.go index c40486cb1..66e17a226 100644 --- a/src/replication/replication.go +++ b/src/replication/replication.go @@ -51,6 +51,8 @@ import ( _ "github.com/goharbor/harbor/src/replication/adapter/helmhub" // register the GitLab adapter _ "github.com/goharbor/harbor/src/replication/adapter/gitlab" + // register the TencentCloud TCR adapter + _ "github.com/goharbor/harbor/src/replication/adapter/tencentcr" ) var ( diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE new file mode 100644 index 000000000..efc75a225 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2017-2018 Tencent Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go new file mode 100644 index 000000000..795576b70 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go @@ -0,0 +1,278 @@ +package common + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "log" + "net/http" + "net/http/httputil" + "strconv" + "strings" + "time" + + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" +) + +type Client struct { + region string + httpClient *http.Client + httpProfile *profile.HttpProfile + profile *profile.ClientProfile + credential *Credential + signMethod string + unsignedPayload bool + debug bool +} + +func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err error) { + if request.GetScheme() == "" { + request.SetScheme(c.httpProfile.Scheme) + } + + if request.GetRootDomain() == "" { + request.SetRootDomain(c.httpProfile.RootDomain) + } + + if request.GetDomain() == "" { + domain := c.httpProfile.Endpoint + if domain == "" { + domain = request.GetServiceDomain(request.GetService()) + } + request.SetDomain(domain) + } + + if request.GetHttpMethod() == "" { + request.SetHttpMethod(c.httpProfile.ReqMethod) + } + + tchttp.CompleteCommonParams(request, c.GetRegion()) + + if c.signMethod == "HmacSHA1" || c.signMethod == "HmacSHA256" { + return c.sendWithSignatureV1(request, response) + } else { + return c.sendWithSignatureV3(request, response) + } +} + +func (c *Client) sendWithSignatureV1(request tchttp.Request, response tchttp.Response) (err error) { + // TODO: not an elegant way, it should be done in common params, but finally it need to refactor + request.GetParams()["Language"] = c.profile.Language + err = tchttp.ConstructParams(request) + if err != nil { + return err + } + err = signRequest(request, c.credential, c.signMethod) + if err != nil { + return err + } + httpRequest, err := http.NewRequest(request.GetHttpMethod(), request.GetUrl(), request.GetBodyReader()) + if err != nil { + return err + } + if request.GetHttpMethod() == "POST" { + httpRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded") + } + if c.debug { + outbytes, err := httputil.DumpRequest(httpRequest, true) + if err != nil { + log.Printf("[ERROR] dump request failed because %s", err) + return err + } + log.Printf("[DEBUG] http request = %s", outbytes) + } + httpResponse, err := c.httpClient.Do(httpRequest) + if err != nil { + msg := fmt.Sprintf("Fail to get response because %s", err) + return errors.NewTencentCloudSDKError("ClientError.NetworkError", msg, "") + } + err = tchttp.ParseFromHttpResponse(httpResponse, response) + return err +} + +func (c *Client) sendWithSignatureV3(request tchttp.Request, response tchttp.Response) (err error) { + headers := map[string]string{ + "Host": request.GetDomain(), + "X-TC-Action": request.GetAction(), + "X-TC-Version": request.GetVersion(), + "X-TC-Timestamp": request.GetParams()["Timestamp"], + "X-TC-RequestClient": request.GetParams()["RequestClient"], + "X-TC-Language": c.profile.Language, + } + if c.region != "" { + headers["X-TC-Region"] = c.region + } + if c.credential.Token != "" { + headers["X-TC-Token"] = c.credential.Token + } + if request.GetHttpMethod() == "GET" { + headers["Content-Type"] = "application/x-www-form-urlencoded" + } else { + headers["Content-Type"] = "application/json" + } + + // start signature v3 process + + // build canonical request string + httpRequestMethod := request.GetHttpMethod() + canonicalURI := "/" + canonicalQueryString := "" + if httpRequestMethod == "GET" { + err = tchttp.ConstructParams(request) + if err != nil { + return err + } + params := make(map[string]string) + for key, value := range request.GetParams() { + params[key] = value + } + delete(params, "Action") + delete(params, "Version") + delete(params, "Nonce") + delete(params, "Region") + delete(params, "RequestClient") + delete(params, "Timestamp") + canonicalQueryString = tchttp.GetUrlQueriesEncoded(params) + } + canonicalHeaders := fmt.Sprintf("content-type:%s\nhost:%s\n", headers["Content-Type"], headers["Host"]) + signedHeaders := "content-type;host" + requestPayload := "" + if httpRequestMethod == "POST" { + b, err := json.Marshal(request) + if err != nil { + return err + } + requestPayload = string(b) + } + hashedRequestPayload := "" + if c.unsignedPayload { + hashedRequestPayload = sha256hex("UNSIGNED-PAYLOAD") + headers["X-TC-Content-SHA256"] = "UNSIGNED-PAYLOAD" + } else { + hashedRequestPayload = sha256hex(requestPayload) + } + canonicalRequest := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s", + httpRequestMethod, + canonicalURI, + canonicalQueryString, + canonicalHeaders, + signedHeaders, + hashedRequestPayload) + //log.Println("canonicalRequest:", canonicalRequest) + + // build string to sign + algorithm := "TC3-HMAC-SHA256" + requestTimestamp := headers["X-TC-Timestamp"] + timestamp, _ := strconv.ParseInt(requestTimestamp, 10, 64) + t := time.Unix(timestamp, 0).UTC() + // must be the format 2006-01-02, ref to package time for more info + date := t.Format("2006-01-02") + credentialScope := fmt.Sprintf("%s/%s/tc3_request", date, request.GetService()) + hashedCanonicalRequest := sha256hex(canonicalRequest) + string2sign := fmt.Sprintf("%s\n%s\n%s\n%s", + algorithm, + requestTimestamp, + credentialScope, + hashedCanonicalRequest) + //log.Println("string2sign", string2sign) + + // sign string + secretDate := hmacsha256(date, "TC3"+c.credential.SecretKey) + secretService := hmacsha256(request.GetService(), secretDate) + secretKey := hmacsha256("tc3_request", secretService) + signature := hex.EncodeToString([]byte(hmacsha256(string2sign, secretKey))) + //log.Println("signature", signature) + + // build authorization + authorization := fmt.Sprintf("%s Credential=%s/%s, SignedHeaders=%s, Signature=%s", + algorithm, + c.credential.SecretId, + credentialScope, + signedHeaders, + signature) + //log.Println("authorization", authorization) + + headers["Authorization"] = authorization + url := request.GetScheme() + "://" + request.GetDomain() + request.GetPath() + if canonicalQueryString != "" { + url = url + "?" + canonicalQueryString + } + httpRequest, err := http.NewRequest(httpRequestMethod, url, strings.NewReader(requestPayload)) + if err != nil { + return err + } + for k, v := range headers { + httpRequest.Header[k] = []string{v} + } + if c.debug { + outbytes, err := httputil.DumpRequest(httpRequest, true) + if err != nil { + log.Printf("[ERROR] dump request failed because %s", err) + return err + } + log.Printf("[DEBUG] http request = %s", outbytes) + } + httpResponse, err := c.httpClient.Do(httpRequest) + if err != nil { + msg := fmt.Sprintf("Fail to get response because %s", err) + return errors.NewTencentCloudSDKError("ClientError.NetworkError", msg, "") + } + err = tchttp.ParseFromHttpResponse(httpResponse, response) + return err +} + +func (c *Client) GetRegion() string { + return c.region +} + +func (c *Client) Init(region string) *Client { + c.httpClient = &http.Client{} + c.region = region + c.signMethod = "TC3-HMAC-SHA256" + c.debug = false + log.SetFlags(log.LstdFlags | log.Lshortfile) + return c +} + +func (c *Client) WithSecretId(secretId, secretKey string) *Client { + c.credential = NewCredential(secretId, secretKey) + return c +} + +func (c *Client) WithCredential(cred *Credential) *Client { + c.credential = cred + return c +} + +func (c *Client) WithProfile(clientProfile *profile.ClientProfile) *Client { + c.profile = clientProfile + c.signMethod = clientProfile.SignMethod + c.unsignedPayload = clientProfile.UnsignedPayload + c.httpProfile = clientProfile.HttpProfile + c.debug = clientProfile.Debug + c.httpClient.Timeout = time.Duration(c.httpProfile.ReqTimeout) * time.Second + return c +} + +func (c *Client) WithSignatureMethod(method string) *Client { + c.signMethod = method + return c +} + +func (c *Client) WithHttpTransport(transport http.RoundTripper) *Client { + c.httpClient.Transport = transport + return c +} + +func (c *Client) WithDebug(flag bool) *Client { + c.debug = flag + return c +} + +func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) { + client = &Client{} + client.Init(region).WithSecretId(secretId, secretKey) + return +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go new file mode 100644 index 000000000..b734c1373 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go @@ -0,0 +1,58 @@ +package common + +type Credential struct { + SecretId string + SecretKey string + Token string +} + +func NewCredential(secretId, secretKey string) *Credential { + return &Credential{ + SecretId: secretId, + SecretKey: secretKey, + } +} + +func NewTokenCredential(secretId, secretKey, token string) *Credential { + return &Credential{ + SecretId: secretId, + SecretKey: secretKey, + Token: token, + } +} + +func (c *Credential) GetCredentialParams() map[string]string { + p := map[string]string{ + "SecretId": c.SecretId, + } + if c.Token != "" { + p["Token"] = c.Token + } + return p +} + +// Nowhere use them and we haven't well designed these structures and +// underlying method, which leads to the situation that it is hard to +// refactor it to interfaces. +// Hence they are removed and merged into Credential. + +//type TokenCredential struct { +// SecretId string +// SecretKey string +// Token string +//} + +//func NewTokenCredential(secretId, secretKey, token string) *TokenCredential { +// return &TokenCredential{ +// SecretId: secretId, +// SecretKey: secretKey, +// Token: token, +// } +//} + +//func (c *TokenCredential) GetCredentialParams() map[string]string { +// return map[string]string{ +// "SecretId": c.SecretId, +// "Token": c.Token, +// } +//} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go new file mode 100644 index 000000000..27589e59a --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go @@ -0,0 +1,35 @@ +package errors + +import ( + "fmt" +) + +type TencentCloudSDKError struct { + Code string + Message string + RequestId string +} + +func (e *TencentCloudSDKError) Error() string { + return fmt.Sprintf("[TencentCloudSDKError] Code=%s, Message=%s, RequestId=%s", e.Code, e.Message, e.RequestId) +} + +func NewTencentCloudSDKError(code, message, requestId string) error { + return &TencentCloudSDKError{ + Code: code, + Message: message, + RequestId: requestId, + } +} + +func (e *TencentCloudSDKError) GetCode() string { + return e.Code +} + +func (e *TencentCloudSDKError) GetMessage() string { + return e.Message +} + +func (e *TencentCloudSDKError) GetRequestId() string { + return e.RequestId +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go new file mode 100644 index 000000000..a006ca8f7 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go @@ -0,0 +1,275 @@ +package common + +import ( + "io" + //"log" + "math/rand" + "net/url" + "reflect" + "strconv" + "strings" + "time" +) + +const ( + POST = "POST" + GET = "GET" + + HTTP = "http" + HTTPS = "https" + + RootDomain = "tencentcloudapi.com" + Path = "/" +) + +type Request interface { + GetAction() string + GetBodyReader() io.Reader + GetScheme() string + GetRootDomain() string + GetServiceDomain(string) string + GetDomain() string + GetHttpMethod() string + GetParams() map[string]string + GetPath() string + GetService() string + GetUrl() string + GetVersion() string + SetScheme(string) + SetRootDomain(string) + SetDomain(string) + SetHttpMethod(string) +} + +type BaseRequest struct { + httpMethod string + scheme string + rootDomain string + domain string + path string + params map[string]string + formParams map[string]string + + service string + version string + action string +} + +func (r *BaseRequest) GetAction() string { + return r.action +} + +func (r *BaseRequest) GetHttpMethod() string { + return r.httpMethod +} + +func (r *BaseRequest) GetParams() map[string]string { + return r.params +} + +func (r *BaseRequest) GetPath() string { + return r.path +} + +func (r *BaseRequest) GetDomain() string { + return r.domain +} + +func (r *BaseRequest) GetScheme() string { + return r.scheme +} + +func (r *BaseRequest) GetRootDomain() string { + return r.rootDomain +} + +func (r *BaseRequest) GetServiceDomain(service string) (domain string) { + rootDomain := r.rootDomain + if rootDomain == "" { + rootDomain = RootDomain + } + domain = service + "." + rootDomain + return +} + +func (r *BaseRequest) SetDomain(domain string) { + r.domain = domain +} + +func (r *BaseRequest) SetScheme(scheme string) { + scheme = strings.ToLower(scheme) + switch scheme { + case HTTP: + r.scheme = HTTP + default: + r.scheme = HTTPS + } +} + +func (r *BaseRequest) SetRootDomain(rootDomain string) { + r.rootDomain = rootDomain +} + +func (r *BaseRequest) SetHttpMethod(method string) { + switch strings.ToUpper(method) { + case POST: + { + r.httpMethod = POST + } + case GET: + { + r.httpMethod = GET + } + default: + { + r.httpMethod = GET + } + } +} + +func (r *BaseRequest) GetService() string { + return r.service +} + +func (r *BaseRequest) GetUrl() string { + if r.httpMethod == GET { + return r.GetScheme() + "://" + r.domain + r.path + "?" + GetUrlQueriesEncoded(r.params) + } else if r.httpMethod == POST { + return r.GetScheme() + "://" + r.domain + r.path + } else { + return "" + } +} + +func (r *BaseRequest) GetVersion() string { + return r.version +} + +func GetUrlQueriesEncoded(params map[string]string) string { + values := url.Values{} + for key, value := range params { + if value != "" { + values.Add(key, value) + } + } + return values.Encode() +} + +func (r *BaseRequest) GetBodyReader() io.Reader { + if r.httpMethod == POST { + s := GetUrlQueriesEncoded(r.params) + return strings.NewReader(s) + } else { + return strings.NewReader("") + } +} + +func (r *BaseRequest) Init() *BaseRequest { + r.domain = "" + r.path = Path + r.params = make(map[string]string) + r.formParams = make(map[string]string) + return r +} + +func (r *BaseRequest) WithApiInfo(service, version, action string) *BaseRequest { + r.service = service + r.version = version + r.action = action + return r +} + +// Deprecated, use request.GetServiceDomain instead +func GetServiceDomain(service string) (domain string) { + domain = service + "." + RootDomain + return +} + +func CompleteCommonParams(request Request, region string) { + params := request.GetParams() + params["Region"] = region + if request.GetVersion() != "" { + params["Version"] = request.GetVersion() + } + params["Action"] = request.GetAction() + params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10) + params["Nonce"] = strconv.Itoa(rand.Int()) + params["RequestClient"] = "SDK_GO_1.0.62" +} + +func ConstructParams(req Request) (err error) { + value := reflect.ValueOf(req).Elem() + err = flatStructure(value, req, "") + //log.Printf("[DEBUG] params=%s", req.GetParams()) + return +} + +func flatStructure(value reflect.Value, request Request, prefix string) (err error) { + //log.Printf("[DEBUG] reflect value: %v", value.Type()) + valueType := value.Type() + for i := 0; i < valueType.NumField(); i++ { + tag := valueType.Field(i).Tag + nameTag, hasNameTag := tag.Lookup("name") + if !hasNameTag { + continue + } + field := value.Field(i) + kind := field.Kind() + if kind == reflect.Ptr && field.IsNil() { + continue + } + if kind == reflect.Ptr { + field = field.Elem() + kind = field.Kind() + } + key := prefix + nameTag + if kind == reflect.String { + s := field.String() + if s != "" { + request.GetParams()[key] = s + } + } else if kind == reflect.Bool { + request.GetParams()[key] = strconv.FormatBool(field.Bool()) + } else if kind == reflect.Int || kind == reflect.Int64 { + request.GetParams()[key] = strconv.FormatInt(field.Int(), 10) + } else if kind == reflect.Uint || kind == reflect.Uint64 { + request.GetParams()[key] = strconv.FormatUint(field.Uint(), 10) + } else if kind == reflect.Float64 { + request.GetParams()[key] = strconv.FormatFloat(field.Float(), 'f', -1, 64) + } else if kind == reflect.Slice { + list := value.Field(i) + for j := 0; j < list.Len(); j++ { + vj := list.Index(j) + key := prefix + nameTag + "." + strconv.Itoa(j) + kind = vj.Kind() + if kind == reflect.Ptr && vj.IsNil() { + continue + } + if kind == reflect.Ptr { + vj = vj.Elem() + kind = vj.Kind() + } + if kind == reflect.String { + request.GetParams()[key] = vj.String() + } else if kind == reflect.Bool { + request.GetParams()[key] = strconv.FormatBool(vj.Bool()) + } else if kind == reflect.Int || kind == reflect.Int64 { + request.GetParams()[key] = strconv.FormatInt(vj.Int(), 10) + } else if kind == reflect.Uint || kind == reflect.Uint64 { + request.GetParams()[key] = strconv.FormatUint(vj.Uint(), 10) + } else if kind == reflect.Float64 { + request.GetParams()[key] = strconv.FormatFloat(vj.Float(), 'f', -1, 64) + } else { + if err = flatStructure(vj, request, key+"."); err != nil { + return + } + } + } + } else { + if err = flatStructure(reflect.ValueOf(field.Interface()), request, prefix+nameTag+"."); err != nil { + return + } + } + } + return +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go new file mode 100644 index 000000000..fd18e2064 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go @@ -0,0 +1,81 @@ +package common + +import ( + "encoding/json" + "fmt" + "io/ioutil" + //"log" + "net/http" + + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" +) + +type Response interface { + ParseErrorFromHTTPResponse(body []byte) error +} + +type BaseResponse struct { +} + +type ErrorResponse struct { + Response struct { + Error struct { + Code string `json:"Code"` + Message string `json:"Message"` + } `json:"Error,omitempty"` + RequestId string `json:"RequestId"` + } `json:"Response"` +} + +type DeprecatedAPIErrorResponse struct { + Code int `json:"code"` + Message string `json:"message"` + CodeDesc string `json:"codeDesc"` +} + +func (r *BaseResponse) ParseErrorFromHTTPResponse(body []byte) (err error) { + resp := &ErrorResponse{} + err = json.Unmarshal(body, resp) + if err != nil { + msg := fmt.Sprintf("Fail to parse json content: %s, because: %s", body, err) + return errors.NewTencentCloudSDKError("ClientError.ParseJsonError", msg, "") + } + if resp.Response.Error.Code != "" { + return errors.NewTencentCloudSDKError(resp.Response.Error.Code, resp.Response.Error.Message, resp.Response.RequestId) + } + + deprecated := &DeprecatedAPIErrorResponse{} + err = json.Unmarshal(body, deprecated) + if err != nil { + msg := fmt.Sprintf("Fail to parse json content: %s, because: %s", body, err) + return errors.NewTencentCloudSDKError("ClientError.ParseJsonError", msg, "") + } + if deprecated.Code != 0 { + return errors.NewTencentCloudSDKError(deprecated.CodeDesc, deprecated.Message, "") + } + return nil +} + +func ParseFromHttpResponse(hr *http.Response, response Response) (err error) { + defer hr.Body.Close() + body, err := ioutil.ReadAll(hr.Body) + if err != nil { + msg := fmt.Sprintf("Fail to read response body because %s", err) + return errors.NewTencentCloudSDKError("ClientError.IOError", msg, "") + } + if hr.StatusCode != 200 { + msg := fmt.Sprintf("Request fail with http status code: %s, with body: %s", hr.Status, body) + return errors.NewTencentCloudSDKError("ClientError.HttpStatusCodeError", msg, "") + } + //log.Printf("[DEBUG] Response Body=%s", body) + err = response.ParseErrorFromHTTPResponse(body) + if err != nil { + return + } + err = json.Unmarshal(body, &response) + if err != nil { + msg := fmt.Sprintf("Fail to parse json content: %s, because: %s", body, err) + return errors.NewTencentCloudSDKError("ClientError.ParseJsonError", msg, "") + } + return +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go new file mode 100644 index 000000000..bc876801c --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go @@ -0,0 +1,23 @@ +package profile + +type ClientProfile struct { + HttpProfile *HttpProfile + // Valid choices: HmacSHA1, HmacSHA256, TC3-HMAC-SHA256. + // Default value is TC3-HMAC-SHA256. + SignMethod string + UnsignedPayload bool + // Valid choices: zh-CN, en-US. + // Default value is zh-CN. + Language string + Debug bool +} + +func NewClientProfile() *ClientProfile { + return &ClientProfile{ + HttpProfile: NewHttpProfile(), + SignMethod: "TC3-HMAC-SHA256", + UnsignedPayload: false, + Language: "zh-CN", + Debug: false, + } +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go new file mode 100644 index 000000000..596432d21 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go @@ -0,0 +1,21 @@ +package profile + +type HttpProfile struct { + ReqMethod string + ReqTimeout int + Scheme string + RootDomain string + Endpoint string + // Deprecated, use Scheme instead + Protocol string +} + +func NewHttpProfile() *HttpProfile { + return &HttpProfile{ + ReqMethod: "POST", + ReqTimeout: 60, + Scheme: "HTTPS", + RootDomain: "", + Endpoint: "", + } +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/regions/regions.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/regions/regions.go new file mode 100644 index 000000000..8b2b6d113 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/regions/regions.go @@ -0,0 +1,58 @@ +// Copyright (c) 2018 Tencent Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package regions + +const ( + // 曼谷 + Bangkok = "ap-bangkok" + // 北京 + Beijing = "ap-beijing" + // 成都 + Chengdu = "ap-chengdu" + // 重庆 + Chongqing = "ap-chongqing" + // 广州 + Guangzhou = "ap-guangzhou" + // 广州Open + GuangzhouOpen = "ap-guangzhou-open" + // 中国香港 + HongKong = "ap-hongkong" + // 孟买 + Mumbai = "ap-mumbai" + // 首尔 + Seoul = "ap-seoul" + // 上海 + Shanghai = "ap-shanghai" + // 南京 + Nanjing = "ap-nanjing" + // 上海金融 + ShanghaiFSI = "ap-shanghai-fsi" + // 深圳金融 + ShenzhenFSI = "ap-shenzhen-fsi" + // 新加坡 + Singapore = "ap-singapore" + // 东京 + Tokyo = "ap-tokyo" + // 法兰克福 + Frankfurt = "eu-frankfurt" + // 莫斯科 + Moscow = "eu-moscow" + // 阿什本 + Ashburn = "na-ashburn" + // 硅谷 + SiliconValley = "na-siliconvalley" + // 多伦多 + Toronto = "na-toronto" +) diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go new file mode 100644 index 000000000..0aa7b7355 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go @@ -0,0 +1,94 @@ +package common + +import ( + "bytes" + "crypto/hmac" + "crypto/sha1" + "crypto/sha256" + "encoding/base64" + "encoding/hex" + "sort" + + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" +) + +const ( + SHA256 = "HmacSHA256" + SHA1 = "HmacSHA1" +) + +func Sign(s, secretKey, method string) string { + hashed := hmac.New(sha1.New, []byte(secretKey)) + if method == SHA256 { + hashed = hmac.New(sha256.New, []byte(secretKey)) + } + hashed.Write([]byte(s)) + + return base64.StdEncoding.EncodeToString(hashed.Sum(nil)) +} + +func sha256hex(s string) string { + b := sha256.Sum256([]byte(s)) + return hex.EncodeToString(b[:]) +} + +func hmacsha256(s, key string) string { + hashed := hmac.New(sha256.New, []byte(key)) + hashed.Write([]byte(s)) + return string(hashed.Sum(nil)) +} + +func signRequest(request tchttp.Request, credential *Credential, method string) (err error) { + if method != SHA256 { + method = SHA1 + } + checkAuthParams(request, credential, method) + s := getStringToSign(request) + signature := Sign(s, credential.SecretKey, method) + request.GetParams()["Signature"] = signature + return +} + +func checkAuthParams(request tchttp.Request, credential *Credential, method string) { + params := request.GetParams() + credentialParams := credential.GetCredentialParams() + for key, value := range credentialParams { + params[key] = value + } + params["SignatureMethod"] = method + delete(params, "Signature") +} + +func getStringToSign(request tchttp.Request) string { + method := request.GetHttpMethod() + domain := request.GetDomain() + path := request.GetPath() + + var buf bytes.Buffer + buf.WriteString(method) + buf.WriteString(domain) + buf.WriteString(path) + buf.WriteString("?") + + params := request.GetParams() + // sort params + keys := make([]string, 0, len(params)) + for k, _ := range params { + keys = append(keys, k) + } + sort.Strings(keys) + + for i := range keys { + k := keys[i] + // TODO: check if server side allows empty value in url. + if params[k] == "" { + continue + } + buf.WriteString(k) + buf.WriteString("=") + buf.WriteString(params[k]) + buf.WriteString("&") + } + buf.Truncate(buf.Len() - 1) + return buf.String() +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go new file mode 100644 index 000000000..6da779da9 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go @@ -0,0 +1,95 @@ +package common + +func IntPtr(v int) *int { + return &v +} + +func Int64Ptr(v int64) *int64 { + return &v +} + +func UintPtr(v uint) *uint { + return &v +} + +func Uint64Ptr(v uint64) *uint64 { + return &v +} + +func Float64Ptr(v float64) *float64 { + return &v +} + +func BoolPtr(v bool) *bool { + return &v +} + +func StringPtr(v string) *string { + return &v +} + +func StringValues(ptrs []*string) []string { + values := make([]string, len(ptrs)) + for i := 0; i < len(ptrs); i++ { + if ptrs[i] != nil { + values[i] = *ptrs[i] + } + } + return values +} + +func IntPtrs(vals []int) []*int { + ptrs := make([]*int, len(vals)) + for i := 0; i < len(vals); i++ { + ptrs[i] = &vals[i] + } + return ptrs +} + +func Int64Ptrs(vals []int64) []*int64 { + ptrs := make([]*int64, len(vals)) + for i := 0; i < len(vals); i++ { + ptrs[i] = &vals[i] + } + return ptrs +} + +func UintPtrs(vals []uint) []*uint { + ptrs := make([]*uint, len(vals)) + for i := 0; i < len(vals); i++ { + ptrs[i] = &vals[i] + } + return ptrs +} + +func Uint64Ptrs(vals []uint64) []*uint64 { + ptrs := make([]*uint64, len(vals)) + for i := 0; i < len(vals); i++ { + ptrs[i] = &vals[i] + } + return ptrs +} + +func Float64Ptrs(vals []float64) []*float64 { + ptrs := make([]*float64, len(vals)) + for i := 0; i < len(vals); i++ { + ptrs[i] = &vals[i] + } + return ptrs +} + +func BoolPtrs(vals []bool) []*bool { + ptrs := make([]*bool, len(vals)) + for i := 0; i < len(vals); i++ { + ptrs[i] = &vals[i] + } + return ptrs +} + +func StringPtrs(vals []string) []*string { + ptrs := make([]*string, len(vals)) + for i := 0; i < len(vals); i++ { + ptrs[i] = &vals[i] + } + return ptrs +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924/client.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924/client.go new file mode 100644 index 000000000..4cae02628 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924/client.go @@ -0,0 +1,1519 @@ +// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v20190924 + +import ( + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" +) + +const APIVersion = "2019-09-24" + +type Client struct { + common.Client +} + +// Deprecated +func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) { + cpf := profile.NewClientProfile() + client = &Client{} + client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf) + return +} + +func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) { + client = &Client{} + client.Init(region). + WithCredential(credential). + WithProfile(clientProfile) + return +} + + +func NewBatchDeleteImagePersonalRequest() (request *BatchDeleteImagePersonalRequest) { + request = &BatchDeleteImagePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "BatchDeleteImagePersonal") + return +} + +func NewBatchDeleteImagePersonalResponse() (response *BatchDeleteImagePersonalResponse) { + response = &BatchDeleteImagePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版镜像仓库中批量删除Tag +func (c *Client) BatchDeleteImagePersonal(request *BatchDeleteImagePersonalRequest) (response *BatchDeleteImagePersonalResponse, err error) { + if request == nil { + request = NewBatchDeleteImagePersonalRequest() + } + response = NewBatchDeleteImagePersonalResponse() + err = c.Send(request, response) + return +} + +func NewBatchDeleteRepositoryPersonalRequest() (request *BatchDeleteRepositoryPersonalRequest) { + request = &BatchDeleteRepositoryPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "BatchDeleteRepositoryPersonal") + return +} + +func NewBatchDeleteRepositoryPersonalResponse() (response *BatchDeleteRepositoryPersonalResponse) { + response = &BatchDeleteRepositoryPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于个人版镜像仓库中批量删除镜像仓库 +func (c *Client) BatchDeleteRepositoryPersonal(request *BatchDeleteRepositoryPersonalRequest) (response *BatchDeleteRepositoryPersonalResponse, err error) { + if request == nil { + request = NewBatchDeleteRepositoryPersonalRequest() + } + response = NewBatchDeleteRepositoryPersonalResponse() + err = c.Send(request, response) + return +} + +func NewCreateApplicationTriggerPersonalRequest() (request *CreateApplicationTriggerPersonalRequest) { + request = &CreateApplicationTriggerPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateApplicationTriggerPersonal") + return +} + +func NewCreateApplicationTriggerPersonalResponse() (response *CreateApplicationTriggerPersonalResponse) { + response = &CreateApplicationTriggerPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于创建应用更新触发器 +func (c *Client) CreateApplicationTriggerPersonal(request *CreateApplicationTriggerPersonalRequest) (response *CreateApplicationTriggerPersonalResponse, err error) { + if request == nil { + request = NewCreateApplicationTriggerPersonalRequest() + } + response = NewCreateApplicationTriggerPersonalResponse() + err = c.Send(request, response) + return +} + +func NewCreateImageLifecyclePersonalRequest() (request *CreateImageLifecyclePersonalRequest) { + request = &CreateImageLifecyclePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateImageLifecyclePersonal") + return +} + +func NewCreateImageLifecyclePersonalResponse() (response *CreateImageLifecyclePersonalResponse) { + response = &CreateImageLifecyclePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版中创建清理策略 +func (c *Client) CreateImageLifecyclePersonal(request *CreateImageLifecyclePersonalRequest) (response *CreateImageLifecyclePersonalResponse, err error) { + if request == nil { + request = NewCreateImageLifecyclePersonalRequest() + } + response = NewCreateImageLifecyclePersonalResponse() + err = c.Send(request, response) + return +} + +func NewCreateInstanceRequest() (request *CreateInstanceRequest) { + request = &CreateInstanceRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateInstance") + return +} + +func NewCreateInstanceResponse() (response *CreateInstanceResponse) { + response = &CreateInstanceResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 创建实例 +func (c *Client) CreateInstance(request *CreateInstanceRequest) (response *CreateInstanceResponse, err error) { + if request == nil { + request = NewCreateInstanceRequest() + } + response = NewCreateInstanceResponse() + err = c.Send(request, response) + return +} + +func NewCreateInstanceTokenRequest() (request *CreateInstanceTokenRequest) { + request = &CreateInstanceTokenRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateInstanceToken") + return +} + +func NewCreateInstanceTokenResponse() (response *CreateInstanceTokenResponse) { + response = &CreateInstanceTokenResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 创建实例的临时或长期访问凭证 +func (c *Client) CreateInstanceToken(request *CreateInstanceTokenRequest) (response *CreateInstanceTokenResponse, err error) { + if request == nil { + request = NewCreateInstanceTokenRequest() + } + response = NewCreateInstanceTokenResponse() + err = c.Send(request, response) + return +} + +func NewCreateNamespaceRequest() (request *CreateNamespaceRequest) { + request = &CreateNamespaceRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateNamespace") + return +} + +func NewCreateNamespaceResponse() (response *CreateNamespaceResponse) { + response = &CreateNamespaceResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在企业版中创建命名空间 +func (c *Client) CreateNamespace(request *CreateNamespaceRequest) (response *CreateNamespaceResponse, err error) { + if request == nil { + request = NewCreateNamespaceRequest() + } + response = NewCreateNamespaceResponse() + err = c.Send(request, response) + return +} + +func NewCreateNamespacePersonalRequest() (request *CreateNamespacePersonalRequest) { + request = &CreateNamespacePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateNamespacePersonal") + return +} + +func NewCreateNamespacePersonalResponse() (response *CreateNamespacePersonalResponse) { + response = &CreateNamespacePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 创建个人版镜像仓库命名空间,此命名空间全局唯一 +func (c *Client) CreateNamespacePersonal(request *CreateNamespacePersonalRequest) (response *CreateNamespacePersonalResponse, err error) { + if request == nil { + request = NewCreateNamespacePersonalRequest() + } + response = NewCreateNamespacePersonalResponse() + err = c.Send(request, response) + return +} + +func NewCreateRepositoryRequest() (request *CreateRepositoryRequest) { + request = &CreateRepositoryRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateRepository") + return +} + +func NewCreateRepositoryResponse() (response *CreateRepositoryResponse) { + response = &CreateRepositoryResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于企业版创建镜像仓库 +func (c *Client) CreateRepository(request *CreateRepositoryRequest) (response *CreateRepositoryResponse, err error) { + if request == nil { + request = NewCreateRepositoryRequest() + } + response = NewCreateRepositoryResponse() + err = c.Send(request, response) + return +} + +func NewCreateRepositoryPersonalRequest() (request *CreateRepositoryPersonalRequest) { + request = &CreateRepositoryPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateRepositoryPersonal") + return +} + +func NewCreateRepositoryPersonalResponse() (response *CreateRepositoryPersonalResponse) { + response = &CreateRepositoryPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版仓库中创建镜像仓库 +func (c *Client) CreateRepositoryPersonal(request *CreateRepositoryPersonalRequest) (response *CreateRepositoryPersonalResponse, err error) { + if request == nil { + request = NewCreateRepositoryPersonalRequest() + } + response = NewCreateRepositoryPersonalResponse() + err = c.Send(request, response) + return +} + +func NewCreateUserPersonalRequest() (request *CreateUserPersonalRequest) { + request = &CreateUserPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateUserPersonal") + return +} + +func NewCreateUserPersonalResponse() (response *CreateUserPersonalResponse) { + response = &CreateUserPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 创建个人用户 +func (c *Client) CreateUserPersonal(request *CreateUserPersonalRequest) (response *CreateUserPersonalResponse, err error) { + if request == nil { + request = NewCreateUserPersonalRequest() + } + response = NewCreateUserPersonalResponse() + err = c.Send(request, response) + return +} + +func NewCreateWebhookTriggerRequest() (request *CreateWebhookTriggerRequest) { + request = &CreateWebhookTriggerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "CreateWebhookTrigger") + return +} + +func NewCreateWebhookTriggerResponse() (response *CreateWebhookTriggerResponse) { + response = &CreateWebhookTriggerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 创建触发器 +func (c *Client) CreateWebhookTrigger(request *CreateWebhookTriggerRequest) (response *CreateWebhookTriggerResponse, err error) { + if request == nil { + request = NewCreateWebhookTriggerRequest() + } + response = NewCreateWebhookTriggerResponse() + err = c.Send(request, response) + return +} + +func NewDeleteApplicationTriggerPersonalRequest() (request *DeleteApplicationTriggerPersonalRequest) { + request = &DeleteApplicationTriggerPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteApplicationTriggerPersonal") + return +} + +func NewDeleteApplicationTriggerPersonalResponse() (response *DeleteApplicationTriggerPersonalResponse) { + response = &DeleteApplicationTriggerPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于删除应用更新触发器 +func (c *Client) DeleteApplicationTriggerPersonal(request *DeleteApplicationTriggerPersonalRequest) (response *DeleteApplicationTriggerPersonalResponse, err error) { + if request == nil { + request = NewDeleteApplicationTriggerPersonalRequest() + } + response = NewDeleteApplicationTriggerPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDeleteImageRequest() (request *DeleteImageRequest) { + request = &DeleteImageRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteImage") + return +} + +func NewDeleteImageResponse() (response *DeleteImageResponse) { + response = &DeleteImageResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 删除指定镜像 +func (c *Client) DeleteImage(request *DeleteImageRequest) (response *DeleteImageResponse, err error) { + if request == nil { + request = NewDeleteImageRequest() + } + response = NewDeleteImageResponse() + err = c.Send(request, response) + return +} + +func NewDeleteImageLifecycleGlobalPersonalRequest() (request *DeleteImageLifecycleGlobalPersonalRequest) { + request = &DeleteImageLifecycleGlobalPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteImageLifecycleGlobalPersonal") + return +} + +func NewDeleteImageLifecycleGlobalPersonalResponse() (response *DeleteImageLifecycleGlobalPersonalResponse) { + response = &DeleteImageLifecycleGlobalPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于删除个人版全局镜像版本自动清理策略 +func (c *Client) DeleteImageLifecycleGlobalPersonal(request *DeleteImageLifecycleGlobalPersonalRequest) (response *DeleteImageLifecycleGlobalPersonalResponse, err error) { + if request == nil { + request = NewDeleteImageLifecycleGlobalPersonalRequest() + } + response = NewDeleteImageLifecycleGlobalPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDeleteImageLifecyclePersonalRequest() (request *DeleteImageLifecyclePersonalRequest) { + request = &DeleteImageLifecyclePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteImageLifecyclePersonal") + return +} + +func NewDeleteImageLifecyclePersonalResponse() (response *DeleteImageLifecyclePersonalResponse) { + response = &DeleteImageLifecyclePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版镜像仓库中删除仓库Tag自动清理策略 +func (c *Client) DeleteImageLifecyclePersonal(request *DeleteImageLifecyclePersonalRequest) (response *DeleteImageLifecyclePersonalResponse, err error) { + if request == nil { + request = NewDeleteImageLifecyclePersonalRequest() + } + response = NewDeleteImageLifecyclePersonalResponse() + err = c.Send(request, response) + return +} + +func NewDeleteImagePersonalRequest() (request *DeleteImagePersonalRequest) { + request = &DeleteImagePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteImagePersonal") + return +} + +func NewDeleteImagePersonalResponse() (response *DeleteImagePersonalResponse) { + response = &DeleteImagePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版中删除tag +func (c *Client) DeleteImagePersonal(request *DeleteImagePersonalRequest) (response *DeleteImagePersonalResponse, err error) { + if request == nil { + request = NewDeleteImagePersonalRequest() + } + response = NewDeleteImagePersonalResponse() + err = c.Send(request, response) + return +} + +func NewDeleteInstanceRequest() (request *DeleteInstanceRequest) { + request = &DeleteInstanceRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteInstance") + return +} + +func NewDeleteInstanceResponse() (response *DeleteInstanceResponse) { + response = &DeleteInstanceResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 删除镜像仓库企业版实例 +func (c *Client) DeleteInstance(request *DeleteInstanceRequest) (response *DeleteInstanceResponse, err error) { + if request == nil { + request = NewDeleteInstanceRequest() + } + response = NewDeleteInstanceResponse() + err = c.Send(request, response) + return +} + +func NewDeleteInstanceTokenRequest() (request *DeleteInstanceTokenRequest) { + request = &DeleteInstanceTokenRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteInstanceToken") + return +} + +func NewDeleteInstanceTokenResponse() (response *DeleteInstanceTokenResponse) { + response = &DeleteInstanceTokenResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 删除长期访问凭证 +func (c *Client) DeleteInstanceToken(request *DeleteInstanceTokenRequest) (response *DeleteInstanceTokenResponse, err error) { + if request == nil { + request = NewDeleteInstanceTokenRequest() + } + response = NewDeleteInstanceTokenResponse() + err = c.Send(request, response) + return +} + +func NewDeleteNamespaceRequest() (request *DeleteNamespaceRequest) { + request = &DeleteNamespaceRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteNamespace") + return +} + +func NewDeleteNamespaceResponse() (response *DeleteNamespaceResponse) { + response = &DeleteNamespaceResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 删除命名空间 +func (c *Client) DeleteNamespace(request *DeleteNamespaceRequest) (response *DeleteNamespaceResponse, err error) { + if request == nil { + request = NewDeleteNamespaceRequest() + } + response = NewDeleteNamespaceResponse() + err = c.Send(request, response) + return +} + +func NewDeleteNamespacePersonalRequest() (request *DeleteNamespacePersonalRequest) { + request = &DeleteNamespacePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteNamespacePersonal") + return +} + +func NewDeleteNamespacePersonalResponse() (response *DeleteNamespacePersonalResponse) { + response = &DeleteNamespacePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 删除共享版命名空间 +func (c *Client) DeleteNamespacePersonal(request *DeleteNamespacePersonalRequest) (response *DeleteNamespacePersonalResponse, err error) { + if request == nil { + request = NewDeleteNamespacePersonalRequest() + } + response = NewDeleteNamespacePersonalResponse() + err = c.Send(request, response) + return +} + +func NewDeleteRepositoryRequest() (request *DeleteRepositoryRequest) { + request = &DeleteRepositoryRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteRepository") + return +} + +func NewDeleteRepositoryResponse() (response *DeleteRepositoryResponse) { + response = &DeleteRepositoryResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 删除镜像仓库 +func (c *Client) DeleteRepository(request *DeleteRepositoryRequest) (response *DeleteRepositoryResponse, err error) { + if request == nil { + request = NewDeleteRepositoryRequest() + } + response = NewDeleteRepositoryResponse() + err = c.Send(request, response) + return +} + +func NewDeleteRepositoryPersonalRequest() (request *DeleteRepositoryPersonalRequest) { + request = &DeleteRepositoryPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteRepositoryPersonal") + return +} + +func NewDeleteRepositoryPersonalResponse() (response *DeleteRepositoryPersonalResponse) { + response = &DeleteRepositoryPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于个人版镜像仓库中删除 +func (c *Client) DeleteRepositoryPersonal(request *DeleteRepositoryPersonalRequest) (response *DeleteRepositoryPersonalResponse, err error) { + if request == nil { + request = NewDeleteRepositoryPersonalRequest() + } + response = NewDeleteRepositoryPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDeleteWebhookTriggerRequest() (request *DeleteWebhookTriggerRequest) { + request = &DeleteWebhookTriggerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DeleteWebhookTrigger") + return +} + +func NewDeleteWebhookTriggerResponse() (response *DeleteWebhookTriggerResponse) { + response = &DeleteWebhookTriggerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 删除触发器 +func (c *Client) DeleteWebhookTrigger(request *DeleteWebhookTriggerRequest) (response *DeleteWebhookTriggerResponse, err error) { + if request == nil { + request = NewDeleteWebhookTriggerRequest() + } + response = NewDeleteWebhookTriggerResponse() + err = c.Send(request, response) + return +} + +func NewDescribeApplicationTriggerLogPersonalRequest() (request *DescribeApplicationTriggerLogPersonalRequest) { + request = &DescribeApplicationTriggerLogPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeApplicationTriggerLogPersonal") + return +} + +func NewDescribeApplicationTriggerLogPersonalResponse() (response *DescribeApplicationTriggerLogPersonalResponse) { + response = &DescribeApplicationTriggerLogPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于查询应用更新触发器触发日志 +func (c *Client) DescribeApplicationTriggerLogPersonal(request *DescribeApplicationTriggerLogPersonalRequest) (response *DescribeApplicationTriggerLogPersonalResponse, err error) { + if request == nil { + request = NewDescribeApplicationTriggerLogPersonalRequest() + } + response = NewDescribeApplicationTriggerLogPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeApplicationTriggerPersonalRequest() (request *DescribeApplicationTriggerPersonalRequest) { + request = &DescribeApplicationTriggerPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeApplicationTriggerPersonal") + return +} + +func NewDescribeApplicationTriggerPersonalResponse() (response *DescribeApplicationTriggerPersonalResponse) { + response = &DescribeApplicationTriggerPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于查询应用更新触发器 +func (c *Client) DescribeApplicationTriggerPersonal(request *DescribeApplicationTriggerPersonalRequest) (response *DescribeApplicationTriggerPersonalResponse, err error) { + if request == nil { + request = NewDescribeApplicationTriggerPersonalRequest() + } + response = NewDescribeApplicationTriggerPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeFavorRepositoryPersonalRequest() (request *DescribeFavorRepositoryPersonalRequest) { + request = &DescribeFavorRepositoryPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeFavorRepositoryPersonal") + return +} + +func NewDescribeFavorRepositoryPersonalResponse() (response *DescribeFavorRepositoryPersonalResponse) { + response = &DescribeFavorRepositoryPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询个人收藏仓库 +func (c *Client) DescribeFavorRepositoryPersonal(request *DescribeFavorRepositoryPersonalRequest) (response *DescribeFavorRepositoryPersonalResponse, err error) { + if request == nil { + request = NewDescribeFavorRepositoryPersonalRequest() + } + response = NewDescribeFavorRepositoryPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeImageFilterPersonalRequest() (request *DescribeImageFilterPersonalRequest) { + request = &DescribeImageFilterPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeImageFilterPersonal") + return +} + +func NewDescribeImageFilterPersonalResponse() (response *DescribeImageFilterPersonalResponse) { + response = &DescribeImageFilterPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版中查询与指定tag镜像内容相同的tag列表 +func (c *Client) DescribeImageFilterPersonal(request *DescribeImageFilterPersonalRequest) (response *DescribeImageFilterPersonalResponse, err error) { + if request == nil { + request = NewDescribeImageFilterPersonalRequest() + } + response = NewDescribeImageFilterPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeImageLifecycleGlobalPersonalRequest() (request *DescribeImageLifecycleGlobalPersonalRequest) { + request = &DescribeImageLifecycleGlobalPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeImageLifecycleGlobalPersonal") + return +} + +func NewDescribeImageLifecycleGlobalPersonalResponse() (response *DescribeImageLifecycleGlobalPersonalResponse) { + response = &DescribeImageLifecycleGlobalPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于获取个人版全局镜像版本自动清理策略 +func (c *Client) DescribeImageLifecycleGlobalPersonal(request *DescribeImageLifecycleGlobalPersonalRequest) (response *DescribeImageLifecycleGlobalPersonalResponse, err error) { + if request == nil { + request = NewDescribeImageLifecycleGlobalPersonalRequest() + } + response = NewDescribeImageLifecycleGlobalPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeImageLifecyclePersonalRequest() (request *DescribeImageLifecyclePersonalRequest) { + request = &DescribeImageLifecyclePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeImageLifecyclePersonal") + return +} + +func NewDescribeImageLifecyclePersonalResponse() (response *DescribeImageLifecyclePersonalResponse) { + response = &DescribeImageLifecyclePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于获取个人版仓库中自动清理策略 +func (c *Client) DescribeImageLifecyclePersonal(request *DescribeImageLifecyclePersonalRequest) (response *DescribeImageLifecyclePersonalResponse, err error) { + if request == nil { + request = NewDescribeImageLifecyclePersonalRequest() + } + response = NewDescribeImageLifecyclePersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeImageManifestsRequest() (request *DescribeImageManifestsRequest) { + request = &DescribeImageManifestsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeImageManifests") + return +} + +func NewDescribeImageManifestsResponse() (response *DescribeImageManifestsResponse) { + response = &DescribeImageManifestsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询容器镜像Manifest信息 +func (c *Client) DescribeImageManifests(request *DescribeImageManifestsRequest) (response *DescribeImageManifestsResponse, err error) { + if request == nil { + request = NewDescribeImageManifestsRequest() + } + response = NewDescribeImageManifestsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeImagePersonalRequest() (request *DescribeImagePersonalRequest) { + request = &DescribeImagePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeImagePersonal") + return +} + +func NewDescribeImagePersonalResponse() (response *DescribeImagePersonalResponse) { + response = &DescribeImagePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于获取个人版镜像仓库tag列表 +func (c *Client) DescribeImagePersonal(request *DescribeImagePersonalRequest) (response *DescribeImagePersonalResponse, err error) { + if request == nil { + request = NewDescribeImagePersonalRequest() + } + response = NewDescribeImagePersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeImagesRequest() (request *DescribeImagesRequest) { + request = &DescribeImagesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeImages") + return +} + +func NewDescribeImagesResponse() (response *DescribeImagesResponse) { + response = &DescribeImagesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询镜像版本列表或指定容器镜像信息 +func (c *Client) DescribeImages(request *DescribeImagesRequest) (response *DescribeImagesResponse, err error) { + if request == nil { + request = NewDescribeImagesRequest() + } + response = NewDescribeImagesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeInstanceStatusRequest() (request *DescribeInstanceStatusRequest) { + request = &DescribeInstanceStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeInstanceStatus") + return +} + +func NewDescribeInstanceStatusResponse() (response *DescribeInstanceStatusResponse) { + response = &DescribeInstanceStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询实例当前状态以及过程信息 +func (c *Client) DescribeInstanceStatus(request *DescribeInstanceStatusRequest) (response *DescribeInstanceStatusResponse, err error) { + if request == nil { + request = NewDescribeInstanceStatusRequest() + } + response = NewDescribeInstanceStatusResponse() + err = c.Send(request, response) + return +} + +func NewDescribeInstanceTokenRequest() (request *DescribeInstanceTokenRequest) { + request = &DescribeInstanceTokenRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeInstanceToken") + return +} + +func NewDescribeInstanceTokenResponse() (response *DescribeInstanceTokenResponse) { + response = &DescribeInstanceTokenResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询长期访问凭证信息 +func (c *Client) DescribeInstanceToken(request *DescribeInstanceTokenRequest) (response *DescribeInstanceTokenResponse, err error) { + if request == nil { + request = NewDescribeInstanceTokenRequest() + } + response = NewDescribeInstanceTokenResponse() + err = c.Send(request, response) + return +} + +func NewDescribeInstancesRequest() (request *DescribeInstancesRequest) { + request = &DescribeInstancesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeInstances") + return +} + +func NewDescribeInstancesResponse() (response *DescribeInstancesResponse) { + response = &DescribeInstancesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询实例信息 +func (c *Client) DescribeInstances(request *DescribeInstancesRequest) (response *DescribeInstancesResponse, err error) { + if request == nil { + request = NewDescribeInstancesRequest() + } + response = NewDescribeInstancesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeNamespacePersonalRequest() (request *DescribeNamespacePersonalRequest) { + request = &DescribeNamespacePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeNamespacePersonal") + return +} + +func NewDescribeNamespacePersonalResponse() (response *DescribeNamespacePersonalResponse) { + response = &DescribeNamespacePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询个人版命名空间信息 +func (c *Client) DescribeNamespacePersonal(request *DescribeNamespacePersonalRequest) (response *DescribeNamespacePersonalResponse, err error) { + if request == nil { + request = NewDescribeNamespacePersonalRequest() + } + response = NewDescribeNamespacePersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeNamespacesRequest() (request *DescribeNamespacesRequest) { + request = &DescribeNamespacesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeNamespaces") + return +} + +func NewDescribeNamespacesResponse() (response *DescribeNamespacesResponse) { + response = &DescribeNamespacesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询命名空间列表或指定命名空间信息 +func (c *Client) DescribeNamespaces(request *DescribeNamespacesRequest) (response *DescribeNamespacesResponse, err error) { + if request == nil { + request = NewDescribeNamespacesRequest() + } + response = NewDescribeNamespacesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeReplicationInstanceCreateTasksRequest() (request *DescribeReplicationInstanceCreateTasksRequest) { + request = &DescribeReplicationInstanceCreateTasksRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeReplicationInstanceCreateTasks") + return +} + +func NewDescribeReplicationInstanceCreateTasksResponse() (response *DescribeReplicationInstanceCreateTasksResponse) { + response = &DescribeReplicationInstanceCreateTasksResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询创建从实例任务状态 +func (c *Client) DescribeReplicationInstanceCreateTasks(request *DescribeReplicationInstanceCreateTasksRequest) (response *DescribeReplicationInstanceCreateTasksResponse, err error) { + if request == nil { + request = NewDescribeReplicationInstanceCreateTasksRequest() + } + response = NewDescribeReplicationInstanceCreateTasksResponse() + err = c.Send(request, response) + return +} + +func NewDescribeReplicationInstancesRequest() (request *DescribeReplicationInstancesRequest) { + request = &DescribeReplicationInstancesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeReplicationInstances") + return +} + +func NewDescribeReplicationInstancesResponse() (response *DescribeReplicationInstancesResponse) { + response = &DescribeReplicationInstancesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询从实例列表 +func (c *Client) DescribeReplicationInstances(request *DescribeReplicationInstancesRequest) (response *DescribeReplicationInstancesResponse, err error) { + if request == nil { + request = NewDescribeReplicationInstancesRequest() + } + response = NewDescribeReplicationInstancesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeRepositoriesRequest() (request *DescribeRepositoriesRequest) { + request = &DescribeRepositoriesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeRepositories") + return +} + +func NewDescribeRepositoriesResponse() (response *DescribeRepositoriesResponse) { + response = &DescribeRepositoriesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询镜像仓库列表或指定镜像仓库信息 +func (c *Client) DescribeRepositories(request *DescribeRepositoriesRequest) (response *DescribeRepositoriesResponse, err error) { + if request == nil { + request = NewDescribeRepositoriesRequest() + } + response = NewDescribeRepositoriesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeRepositoryFilterPersonalRequest() (request *DescribeRepositoryFilterPersonalRequest) { + request = &DescribeRepositoryFilterPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeRepositoryFilterPersonal") + return +} + +func NewDescribeRepositoryFilterPersonalResponse() (response *DescribeRepositoryFilterPersonalResponse) { + response = &DescribeRepositoryFilterPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版镜像仓库中,获取满足输入搜索条件的用户镜像仓库 +func (c *Client) DescribeRepositoryFilterPersonal(request *DescribeRepositoryFilterPersonalRequest) (response *DescribeRepositoryFilterPersonalResponse, err error) { + if request == nil { + request = NewDescribeRepositoryFilterPersonalRequest() + } + response = NewDescribeRepositoryFilterPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeRepositoryOwnerPersonalRequest() (request *DescribeRepositoryOwnerPersonalRequest) { + request = &DescribeRepositoryOwnerPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeRepositoryOwnerPersonal") + return +} + +func NewDescribeRepositoryOwnerPersonalResponse() (response *DescribeRepositoryOwnerPersonalResponse) { + response = &DescribeRepositoryOwnerPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版中获取用户全部的镜像仓库列表 +func (c *Client) DescribeRepositoryOwnerPersonal(request *DescribeRepositoryOwnerPersonalRequest) (response *DescribeRepositoryOwnerPersonalResponse, err error) { + if request == nil { + request = NewDescribeRepositoryOwnerPersonalRequest() + } + response = NewDescribeRepositoryOwnerPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeRepositoryPersonalRequest() (request *DescribeRepositoryPersonalRequest) { + request = &DescribeRepositoryPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeRepositoryPersonal") + return +} + +func NewDescribeRepositoryPersonalResponse() (response *DescribeRepositoryPersonalResponse) { + response = &DescribeRepositoryPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询个人版仓库信息 +func (c *Client) DescribeRepositoryPersonal(request *DescribeRepositoryPersonalRequest) (response *DescribeRepositoryPersonalResponse, err error) { + if request == nil { + request = NewDescribeRepositoryPersonalRequest() + } + response = NewDescribeRepositoryPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeUserQuotaPersonalRequest() (request *DescribeUserQuotaPersonalRequest) { + request = &DescribeUserQuotaPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeUserQuotaPersonal") + return +} + +func NewDescribeUserQuotaPersonalResponse() (response *DescribeUserQuotaPersonalResponse) { + response = &DescribeUserQuotaPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询个人用户配额 +func (c *Client) DescribeUserQuotaPersonal(request *DescribeUserQuotaPersonalRequest) (response *DescribeUserQuotaPersonalResponse, err error) { + if request == nil { + request = NewDescribeUserQuotaPersonalRequest() + } + response = NewDescribeUserQuotaPersonalResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebhookTriggerRequest() (request *DescribeWebhookTriggerRequest) { + request = &DescribeWebhookTriggerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeWebhookTrigger") + return +} + +func NewDescribeWebhookTriggerResponse() (response *DescribeWebhookTriggerResponse) { + response = &DescribeWebhookTriggerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询触发器 +func (c *Client) DescribeWebhookTrigger(request *DescribeWebhookTriggerRequest) (response *DescribeWebhookTriggerResponse, err error) { + if request == nil { + request = NewDescribeWebhookTriggerRequest() + } + response = NewDescribeWebhookTriggerResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebhookTriggerLogRequest() (request *DescribeWebhookTriggerLogRequest) { + request = &DescribeWebhookTriggerLogRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DescribeWebhookTriggerLog") + return +} + +func NewDescribeWebhookTriggerLogResponse() (response *DescribeWebhookTriggerLogResponse) { + response = &DescribeWebhookTriggerLogResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 获取触发器日志 +func (c *Client) DescribeWebhookTriggerLog(request *DescribeWebhookTriggerLogRequest) (response *DescribeWebhookTriggerLogResponse, err error) { + if request == nil { + request = NewDescribeWebhookTriggerLogRequest() + } + response = NewDescribeWebhookTriggerLogResponse() + err = c.Send(request, response) + return +} + +func NewDuplicateImagePersonalRequest() (request *DuplicateImagePersonalRequest) { + request = &DuplicateImagePersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "DuplicateImagePersonal") + return +} + +func NewDuplicateImagePersonalResponse() (response *DuplicateImagePersonalResponse) { + response = &DuplicateImagePersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版镜像仓库中复制镜像版本 +func (c *Client) DuplicateImagePersonal(request *DuplicateImagePersonalRequest) (response *DuplicateImagePersonalResponse, err error) { + if request == nil { + request = NewDuplicateImagePersonalRequest() + } + response = NewDuplicateImagePersonalResponse() + err = c.Send(request, response) + return +} + +func NewManageImageLifecycleGlobalPersonalRequest() (request *ManageImageLifecycleGlobalPersonalRequest) { + request = &ManageImageLifecycleGlobalPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ManageImageLifecycleGlobalPersonal") + return +} + +func NewManageImageLifecycleGlobalPersonalResponse() (response *ManageImageLifecycleGlobalPersonalResponse) { + response = &ManageImageLifecycleGlobalPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于设置个人版全局镜像版本自动清理策略 +func (c *Client) ManageImageLifecycleGlobalPersonal(request *ManageImageLifecycleGlobalPersonalRequest) (response *ManageImageLifecycleGlobalPersonalResponse, err error) { + if request == nil { + request = NewManageImageLifecycleGlobalPersonalRequest() + } + response = NewManageImageLifecycleGlobalPersonalResponse() + err = c.Send(request, response) + return +} + +func NewModifyApplicationTriggerPersonalRequest() (request *ModifyApplicationTriggerPersonalRequest) { + request = &ModifyApplicationTriggerPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ModifyApplicationTriggerPersonal") + return +} + +func NewModifyApplicationTriggerPersonalResponse() (response *ModifyApplicationTriggerPersonalResponse) { + response = &ModifyApplicationTriggerPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于修改应用更新触发器 +func (c *Client) ModifyApplicationTriggerPersonal(request *ModifyApplicationTriggerPersonalRequest) (response *ModifyApplicationTriggerPersonalResponse, err error) { + if request == nil { + request = NewModifyApplicationTriggerPersonalRequest() + } + response = NewModifyApplicationTriggerPersonalResponse() + err = c.Send(request, response) + return +} + +func NewModifyInstanceTokenRequest() (request *ModifyInstanceTokenRequest) { + request = &ModifyInstanceTokenRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ModifyInstanceToken") + return +} + +func NewModifyInstanceTokenResponse() (response *ModifyInstanceTokenResponse) { + response = &ModifyInstanceTokenResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 更新实例内指定长期访问凭证的启用状态 +func (c *Client) ModifyInstanceToken(request *ModifyInstanceTokenRequest) (response *ModifyInstanceTokenResponse, err error) { + if request == nil { + request = NewModifyInstanceTokenRequest() + } + response = NewModifyInstanceTokenResponse() + err = c.Send(request, response) + return +} + +func NewModifyNamespaceRequest() (request *ModifyNamespaceRequest) { + request = &ModifyNamespaceRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ModifyNamespace") + return +} + +func NewModifyNamespaceResponse() (response *ModifyNamespaceResponse) { + response = &ModifyNamespaceResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 更新命名空间信息,当前仅支持修改命名空间访问级别 +func (c *Client) ModifyNamespace(request *ModifyNamespaceRequest) (response *ModifyNamespaceResponse, err error) { + if request == nil { + request = NewModifyNamespaceRequest() + } + response = NewModifyNamespaceResponse() + err = c.Send(request, response) + return +} + +func NewModifyRepositoryRequest() (request *ModifyRepositoryRequest) { + request = &ModifyRepositoryRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ModifyRepository") + return +} + +func NewModifyRepositoryResponse() (response *ModifyRepositoryResponse) { + response = &ModifyRepositoryResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 更新镜像仓库信息,可修改仓库描述信息 +func (c *Client) ModifyRepository(request *ModifyRepositoryRequest) (response *ModifyRepositoryResponse, err error) { + if request == nil { + request = NewModifyRepositoryRequest() + } + response = NewModifyRepositoryResponse() + err = c.Send(request, response) + return +} + +func NewModifyRepositoryAccessPersonalRequest() (request *ModifyRepositoryAccessPersonalRequest) { + request = &ModifyRepositoryAccessPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ModifyRepositoryAccessPersonal") + return +} + +func NewModifyRepositoryAccessPersonalResponse() (response *ModifyRepositoryAccessPersonalResponse) { + response = &ModifyRepositoryAccessPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于更新个人版镜像仓库的访问属性 +func (c *Client) ModifyRepositoryAccessPersonal(request *ModifyRepositoryAccessPersonalRequest) (response *ModifyRepositoryAccessPersonalResponse, err error) { + if request == nil { + request = NewModifyRepositoryAccessPersonalRequest() + } + response = NewModifyRepositoryAccessPersonalResponse() + err = c.Send(request, response) + return +} + +func NewModifyRepositoryInfoPersonalRequest() (request *ModifyRepositoryInfoPersonalRequest) { + request = &ModifyRepositoryInfoPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ModifyRepositoryInfoPersonal") + return +} + +func NewModifyRepositoryInfoPersonalResponse() (response *ModifyRepositoryInfoPersonalResponse) { + response = &ModifyRepositoryInfoPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于在个人版镜像仓库中更新容器镜像描述 +func (c *Client) ModifyRepositoryInfoPersonal(request *ModifyRepositoryInfoPersonalRequest) (response *ModifyRepositoryInfoPersonalResponse, err error) { + if request == nil { + request = NewModifyRepositoryInfoPersonalRequest() + } + response = NewModifyRepositoryInfoPersonalResponse() + err = c.Send(request, response) + return +} + +func NewModifyUserPasswordPersonalRequest() (request *ModifyUserPasswordPersonalRequest) { + request = &ModifyUserPasswordPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ModifyUserPasswordPersonal") + return +} + +func NewModifyUserPasswordPersonalResponse() (response *ModifyUserPasswordPersonalResponse) { + response = &ModifyUserPasswordPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 修改个人用户登录密码 +func (c *Client) ModifyUserPasswordPersonal(request *ModifyUserPasswordPersonalRequest) (response *ModifyUserPasswordPersonalResponse, err error) { + if request == nil { + request = NewModifyUserPasswordPersonalRequest() + } + response = NewModifyUserPasswordPersonalResponse() + err = c.Send(request, response) + return +} + +func NewModifyWebhookTriggerRequest() (request *ModifyWebhookTriggerRequest) { + request = &ModifyWebhookTriggerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ModifyWebhookTrigger") + return +} + +func NewModifyWebhookTriggerResponse() (response *ModifyWebhookTriggerResponse) { + response = &ModifyWebhookTriggerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 更新触发器 +func (c *Client) ModifyWebhookTrigger(request *ModifyWebhookTriggerRequest) (response *ModifyWebhookTriggerResponse, err error) { + if request == nil { + request = NewModifyWebhookTriggerRequest() + } + response = NewModifyWebhookTriggerResponse() + err = c.Send(request, response) + return +} + +func NewValidateNamespaceExistPersonalRequest() (request *ValidateNamespaceExistPersonalRequest) { + request = &ValidateNamespaceExistPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ValidateNamespaceExistPersonal") + return +} + +func NewValidateNamespaceExistPersonalResponse() (response *ValidateNamespaceExistPersonalResponse) { + response = &ValidateNamespaceExistPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 查询个人版用户命名空间是否存在 +func (c *Client) ValidateNamespaceExistPersonal(request *ValidateNamespaceExistPersonalRequest) (response *ValidateNamespaceExistPersonalResponse, err error) { + if request == nil { + request = NewValidateNamespaceExistPersonalRequest() + } + response = NewValidateNamespaceExistPersonalResponse() + err = c.Send(request, response) + return +} + +func NewValidateRepositoryExistPersonalRequest() (request *ValidateRepositoryExistPersonalRequest) { + request = &ValidateRepositoryExistPersonalRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tcr", APIVersion, "ValidateRepositoryExistPersonal") + return +} + +func NewValidateRepositoryExistPersonalResponse() (response *ValidateRepositoryExistPersonalResponse) { + response = &ValidateRepositoryExistPersonalResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// 用于判断个人版仓库是否存在 +func (c *Client) ValidateRepositoryExistPersonal(request *ValidateRepositoryExistPersonalRequest) (response *ValidateRepositoryExistPersonalResponse, err error) { + if request == nil { + request = NewValidateRepositoryExistPersonalRequest() + } + response = NewValidateRepositoryExistPersonalResponse() + err = c.Send(request, response) + return +} diff --git a/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924/models.go b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924/models.go new file mode 100644 index 000000000..7339a1258 --- /dev/null +++ b/src/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924/models.go @@ -0,0 +1,3222 @@ +// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v20190924 + +import ( + "encoding/json" + + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" +) + +type AutoDelStrategyInfo struct { + + // 用户名 + Username *string `json:"Username,omitempty" name:"Username"` + + // 仓库名 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 策略值 + Value *int64 `json:"Value,omitempty" name:"Value"` + + // Valid + Valid *int64 `json:"Valid,omitempty" name:"Valid"` + + // 创建时间 + CreationTime *string `json:"CreationTime,omitempty" name:"CreationTime"` +} + +type AutoDelStrategyInfoResp struct { + + // 总数目 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 自动删除策略列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + StrategyInfo []*AutoDelStrategyInfo `json:"StrategyInfo,omitempty" name:"StrategyInfo" list` +} + +type BatchDeleteImagePersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // Tag列表 + Tags []*string `json:"Tags,omitempty" name:"Tags" list` +} + +func (r *BatchDeleteImagePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *BatchDeleteImagePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type BatchDeleteImagePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *BatchDeleteImagePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *BatchDeleteImagePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type BatchDeleteRepositoryPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称数组 + RepoNames []*string `json:"RepoNames,omitempty" name:"RepoNames" list` +} + +func (r *BatchDeleteRepositoryPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *BatchDeleteRepositoryPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type BatchDeleteRepositoryPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *BatchDeleteRepositoryPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *BatchDeleteRepositoryPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateApplicationTriggerPersonalRequest struct { + *tchttp.BaseRequest + + // 触发器关联的镜像仓库,library/test格式 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 触发器名称 + TriggerName *string `json:"TriggerName,omitempty" name:"TriggerName"` + + // 触发方式,"all"全部触发,"taglist"指定tag触发,"regex"正则触发 + InvokeMethod *string `json:"InvokeMethod,omitempty" name:"InvokeMethod"` + + // 应用所在TKE集群ID + ClusterId *string `json:"ClusterId,omitempty" name:"ClusterId"` + + // 应用所在TKE集群命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // 应用所在TKE集群工作负载类型,支持Deployment、StatefulSet、DaemonSet、CronJob、Job。 + WorkloadType *string `json:"WorkloadType,omitempty" name:"WorkloadType"` + + // 应用所在TKE集群工作负载名称 + WorkloadName *string `json:"WorkloadName,omitempty" name:"WorkloadName"` + + // 应用所在TKE集群工作负载下容器名称 + ContainerName *string `json:"ContainerName,omitempty" name:"ContainerName"` + + // 应用所在TKE集群地域 + ClusterRegion *int64 `json:"ClusterRegion,omitempty" name:"ClusterRegion"` + + // 触发方式对应的表达式 + InvokeExpr *string `json:"InvokeExpr,omitempty" name:"InvokeExpr"` +} + +func (r *CreateApplicationTriggerPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateApplicationTriggerPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateApplicationTriggerPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateApplicationTriggerPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateApplicationTriggerPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateImageLifecyclePersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // keep_last_days:保留最近几天的数据;keep_last_nums:保留最近多少个 + Type *string `json:"Type,omitempty" name:"Type"` + + // 策略值 + Val *int64 `json:"Val,omitempty" name:"Val"` +} + +func (r *CreateImageLifecyclePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateImageLifecyclePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateImageLifecyclePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateImageLifecyclePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateImageLifecyclePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateInstanceRequest struct { + *tchttp.BaseRequest + + // 企业版实例名称 + RegistryName *string `json:"RegistryName,omitempty" name:"RegistryName"` + + // 企业版实例类型 + RegistryType *string `json:"RegistryType,omitempty" name:"RegistryType"` + + // 云标签描述 + TagSpecification *TagSpecification `json:"TagSpecification,omitempty" name:"TagSpecification"` +} + +func (r *CreateInstanceRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateInstanceRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateInstanceResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 企业版实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateInstanceResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateInstanceResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateInstanceTokenRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 访问凭证类型,longterm 为长期访问凭证,temp 为临时访问凭证,默认是临时访问凭证,有效期1小时 + TokenType *string `json:"TokenType,omitempty" name:"TokenType"` + + // 长期访问凭证描述信息 + Desc *string `json:"Desc,omitempty" name:"Desc"` +} + +func (r *CreateInstanceTokenRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateInstanceTokenRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateInstanceTokenResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 用户名 + // 注意:此字段可能返回 null,表示取不到有效值。 + Username *string `json:"Username,omitempty" name:"Username"` + + // 访问凭证 + Token *string `json:"Token,omitempty" name:"Token"` + + // 访问凭证过期时间戳 + ExpTime *int64 `json:"ExpTime,omitempty" name:"ExpTime"` + + // 长期凭证的TokenId,短期凭证没有TokenId + // 注意:此字段可能返回 null,表示取不到有效值。 + TokenId *string `json:"TokenId,omitempty" name:"TokenId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateInstanceTokenResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateInstanceTokenResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateNamespacePersonalRequest struct { + *tchttp.BaseRequest + + // 命名空间名称 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` +} + +func (r *CreateNamespacePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateNamespacePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateNamespacePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateNamespacePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateNamespacePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateNamespaceRequest struct { + *tchttp.BaseRequest + + // 实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间的名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 是否公开,true为公开,fale为私有 + IsPublic *bool `json:"IsPublic,omitempty" name:"IsPublic"` +} + +func (r *CreateNamespaceRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateNamespaceRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateNamespaceResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateNamespaceResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateNamespaceResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateRepositoryPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 是否公共,1:公共,0:私有 + Public *uint64 `json:"Public,omitempty" name:"Public"` + + // 仓库描述 + Description *string `json:"Description,omitempty" name:"Description"` +} + +func (r *CreateRepositoryPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateRepositoryPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateRepositoryPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateRepositoryPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateRepositoryPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateRepositoryRequest struct { + *tchttp.BaseRequest + + // 实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 仓库名称 + RepositoryName *string `json:"RepositoryName,omitempty" name:"RepositoryName"` + + // 仓库简短描述 + BriefDescription *string `json:"BriefDescription,omitempty" name:"BriefDescription"` + + // 仓库详细描述 + Description *string `json:"Description,omitempty" name:"Description"` +} + +func (r *CreateRepositoryRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateRepositoryRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateRepositoryResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateRepositoryResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateRepositoryResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateUserPersonalRequest struct { + *tchttp.BaseRequest + + // 用户密码 + Password *string `json:"Password,omitempty" name:"Password"` +} + +func (r *CreateUserPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateUserPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateUserPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateUserPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateUserPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateWebhookTriggerRequest struct { + *tchttp.BaseRequest + + // 实例 Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 触发器参数 + Trigger *WebhookTrigger `json:"Trigger,omitempty" name:"Trigger"` + + // 命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` +} + +func (r *CreateWebhookTriggerRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateWebhookTriggerRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type CreateWebhookTriggerResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 新建的触发器 + Trigger *WebhookTrigger `json:"Trigger,omitempty" name:"Trigger"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *CreateWebhookTriggerResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *CreateWebhookTriggerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteApplicationTriggerPersonalRequest struct { + *tchttp.BaseRequest + + // 触发器名称 + TriggerName *string `json:"TriggerName,omitempty" name:"TriggerName"` +} + +func (r *DeleteApplicationTriggerPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteApplicationTriggerPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteApplicationTriggerPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteApplicationTriggerPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteApplicationTriggerPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteImageLifecycleGlobalPersonalRequest struct { + *tchttp.BaseRequest +} + +func (r *DeleteImageLifecycleGlobalPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteImageLifecycleGlobalPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteImageLifecycleGlobalPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteImageLifecycleGlobalPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteImageLifecycleGlobalPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteImageLifecyclePersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` +} + +func (r *DeleteImageLifecyclePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteImageLifecyclePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteImageLifecyclePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteImageLifecyclePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteImageLifecyclePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteImagePersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // Tag名 + Tag *string `json:"Tag,omitempty" name:"Tag"` +} + +func (r *DeleteImagePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteImagePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteImagePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteImagePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteImagePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteImageRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 镜像仓库名称 + RepositoryName *string `json:"RepositoryName,omitempty" name:"RepositoryName"` + + // 镜像版本 + ImageVersion *string `json:"ImageVersion,omitempty" name:"ImageVersion"` + + // 命名空间名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` +} + +func (r *DeleteImageRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteImageRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteImageResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteImageResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteImageResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteInstanceRequest struct { + *tchttp.BaseRequest + + // 实例id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 是否删除存储桶,默认为false + DeleteBucket *bool `json:"DeleteBucket,omitempty" name:"DeleteBucket"` +} + +func (r *DeleteInstanceRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteInstanceRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteInstanceResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteInstanceResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteInstanceResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteInstanceTokenRequest struct { + *tchttp.BaseRequest + + // 实例 ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 访问凭证 ID + TokenId *string `json:"TokenId,omitempty" name:"TokenId"` +} + +func (r *DeleteInstanceTokenRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteInstanceTokenRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteInstanceTokenResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteInstanceTokenResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteInstanceTokenResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteNamespacePersonalRequest struct { + *tchttp.BaseRequest + + // 命名空间名称 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` +} + +func (r *DeleteNamespacePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteNamespacePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteNamespacePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteNamespacePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteNamespacePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteNamespaceRequest struct { + *tchttp.BaseRequest + + // 实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间的名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` +} + +func (r *DeleteNamespaceRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteNamespaceRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteNamespaceResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteNamespaceResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteNamespaceResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteRepositoryPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` +} + +func (r *DeleteRepositoryPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteRepositoryPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteRepositoryPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteRepositoryPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteRepositoryPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteRepositoryRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间的名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 仓库名称的名称 + RepositoryName *string `json:"RepositoryName,omitempty" name:"RepositoryName"` +} + +func (r *DeleteRepositoryRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteRepositoryRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteRepositoryResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteRepositoryResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteRepositoryResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteWebhookTriggerRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // 触发器 Id + Id *int64 `json:"Id,omitempty" name:"Id"` +} + +func (r *DeleteWebhookTriggerRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteWebhookTriggerRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteWebhookTriggerResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteWebhookTriggerResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DeleteWebhookTriggerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeApplicationTriggerLogPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 偏移量,默认为0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 返回最大数量,默认 20, 最大值 100 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 升序或降序 + Order *string `json:"Order,omitempty" name:"Order"` + + // 按某列排序 + OrderBy *string `json:"OrderBy,omitempty" name:"OrderBy"` +} + +func (r *DescribeApplicationTriggerLogPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeApplicationTriggerLogPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeApplicationTriggerLogPersonalResp struct { + + // 返回总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 触发日志列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + LogInfo []*TriggerLogResp `json:"LogInfo,omitempty" name:"LogInfo" list` +} + +type DescribeApplicationTriggerLogPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 触发日志返回值 + Data *DescribeApplicationTriggerLogPersonalResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeApplicationTriggerLogPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeApplicationTriggerLogPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeApplicationTriggerPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 触发器名称 + TriggerName *string `json:"TriggerName,omitempty" name:"TriggerName"` + + // 偏移量,默认为0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 返回最大数量,默认 20, 最大值 100 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` +} + +func (r *DescribeApplicationTriggerPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeApplicationTriggerPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeApplicationTriggerPersonalResp struct { + + // 返回条目总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 触发器列表 + TriggerInfo []*TriggerResp `json:"TriggerInfo,omitempty" name:"TriggerInfo" list` +} + +type DescribeApplicationTriggerPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 触发器列表返回值 + Data *DescribeApplicationTriggerPersonalResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeApplicationTriggerPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeApplicationTriggerPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeFavorRepositoryPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 分页Limit + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // Offset用于分页 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` +} + +func (r *DescribeFavorRepositoryPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeFavorRepositoryPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeFavorRepositoryPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 个人收藏仓库列表返回信息 + Data *FavorResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeFavorRepositoryPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeFavorRepositoryPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImageFilterPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // Tag名 + Tag *string `json:"Tag,omitempty" name:"Tag"` +} + +func (r *DescribeImageFilterPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImageFilterPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImageFilterPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // payload + Data *SameImagesResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeImageFilterPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImageFilterPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImageLifecycleGlobalPersonalRequest struct { + *tchttp.BaseRequest +} + +func (r *DescribeImageLifecycleGlobalPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImageLifecycleGlobalPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImageLifecycleGlobalPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 全局自动删除策略信息 + Data *AutoDelStrategyInfoResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeImageLifecycleGlobalPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImageLifecycleGlobalPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImageLifecyclePersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` +} + +func (r *DescribeImageLifecyclePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImageLifecyclePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImageLifecyclePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 自动删除策略信息 + Data *AutoDelStrategyInfoResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeImageLifecyclePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImageLifecyclePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImageManifestsRequest struct { + *tchttp.BaseRequest + + // 实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 镜像仓库名称 + RepositoryName *string `json:"RepositoryName,omitempty" name:"RepositoryName"` + + // 镜像版本 + ImageVersion *string `json:"ImageVersion,omitempty" name:"ImageVersion"` +} + +func (r *DescribeImageManifestsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImageManifestsRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImageManifestsResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 镜像的Manifest信息 + Manifest *string `json:"Manifest,omitempty" name:"Manifest"` + + // 镜像的配置信息 + Config *string `json:"Config,omitempty" name:"Config"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeImageManifestsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImageManifestsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImagePersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 偏移量,默认为0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 返回最大数量,默认 20, 最大值 100 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // tag名称,可根据输入搜索 + Tag *string `json:"Tag,omitempty" name:"Tag"` +} + +func (r *DescribeImagePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImagePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImagePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 镜像tag信息 + Data *TagInfoResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeImagePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImagePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImagesRequest struct { + *tchttp.BaseRequest + + // 实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 镜像仓库名称 + RepositoryName *string `json:"RepositoryName,omitempty" name:"RepositoryName"` + + // 指定镜像版本(Tag),不填默认返回仓库内全部容器镜像 + ImageVersion *string `json:"ImageVersion,omitempty" name:"ImageVersion"` + + // 每页个数,用于分页,默认20 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 页数,默认值为1 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` +} + +func (r *DescribeImagesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImagesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeImagesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 容器镜像信息列表 + ImageInfoList []*TcrImageInfo `json:"ImageInfoList,omitempty" name:"ImageInfoList" list` + + // 容器镜像总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeImagesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeImagesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeInstanceStatusRequest struct { + *tchttp.BaseRequest + + // 实例ID的数组 + RegistryIds []*string `json:"RegistryIds,omitempty" name:"RegistryIds" list` +} + +func (r *DescribeInstanceStatusRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeInstanceStatusRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeInstanceStatusResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 实例的状态列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + RegistryStatusSet []*RegistryStatus `json:"RegistryStatusSet,omitempty" name:"RegistryStatusSet" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeInstanceStatusResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeInstanceStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeInstanceTokenRequest struct { + *tchttp.BaseRequest + + // 实例 ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 分页单页数量 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 分页偏移量 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` +} + +func (r *DescribeInstanceTokenRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeInstanceTokenRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeInstanceTokenResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 长期访问凭证总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 长期访问凭证列表 + Tokens []*TcrInstanceToken `json:"Tokens,omitempty" name:"Tokens" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeInstanceTokenResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeInstanceTokenResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeInstancesRequest struct { + *tchttp.BaseRequest + + // 实例ID列表(为空时, + // 表示获取账号下所有实例) + Registryids []*string `json:"Registryids,omitempty" name:"Registryids" list` + + // 偏移量,默认0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 最大输出条数,默认20,最大为100 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 过滤条件 + Filters []*Filter `json:"Filters,omitempty" name:"Filters" list` + + // 获取所有地域的实例,默认为False + AllRegion *bool `json:"AllRegion,omitempty" name:"AllRegion"` +} + +func (r *DescribeInstancesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeInstancesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeInstancesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 总实例个数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 实例信息列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + Registries []*Registry `json:"Registries,omitempty" name:"Registries" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeInstancesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeInstancesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeNamespacePersonalRequest struct { + *tchttp.BaseRequest + + // 命名空间,支持模糊查询 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // 单页数量 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 偏移量 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` +} + +func (r *DescribeNamespacePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeNamespacePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeNamespacePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 用户命名空间返回信息 + Data *NamespaceInfoResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeNamespacePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeNamespacePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeNamespacesRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 指定命名空间,不填写默认查询所有命名空间 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 每页个数 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 页偏移 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` +} + +func (r *DescribeNamespacesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeNamespacesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeNamespacesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 命名空间列表信息 + NamespaceList []*TcrNamespaceInfo `json:"NamespaceList,omitempty" name:"NamespaceList" list` + + // 总个数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeNamespacesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeNamespacesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeReplicationInstanceCreateTasksRequest struct { + *tchttp.BaseRequest + + // 同步实例Id + ReplicationRegistryId *string `json:"ReplicationRegistryId,omitempty" name:"ReplicationRegistryId"` + + // 同步实例的地域ID + ReplicationRegionId *uint64 `json:"ReplicationRegionId,omitempty" name:"ReplicationRegionId"` +} + +func (r *DescribeReplicationInstanceCreateTasksRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeReplicationInstanceCreateTasksRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeReplicationInstanceCreateTasksResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 任务详情 + TaskDetail []*TaskDetail `json:"TaskDetail,omitempty" name:"TaskDetail" list` + + // 整体任务状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeReplicationInstanceCreateTasksResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeReplicationInstanceCreateTasksResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeReplicationInstancesRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 偏移量,默认0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 最大输出条数,默认20,最大为100 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` +} + +func (r *DescribeReplicationInstancesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeReplicationInstancesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeReplicationInstancesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 总实例个数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 同步实例列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + ReplicationRegistries []*ReplicationRegistry `json:"ReplicationRegistries,omitempty" name:"ReplicationRegistries" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeReplicationInstancesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeReplicationInstancesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeRepositoriesRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 指定命名空间,不填写默认为查询所有命名空间下镜像仓库 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 指定镜像仓库,不填写默认查询指定命名空间下所有镜像仓库 + RepositoryName *string `json:"RepositoryName,omitempty" name:"RepositoryName"` + + // 页数,用于分页 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 每页个数,用于分页 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 基于字段排序,支持的值有-creation_time,-name, -update_time + SortBy *string `json:"SortBy,omitempty" name:"SortBy"` +} + +func (r *DescribeRepositoriesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeRepositoriesRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeRepositoriesResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 仓库信息列表 + RepositoryList []*TcrRepositoryInfo `json:"RepositoryList,omitempty" name:"RepositoryList" list` + + // 总个数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeRepositoriesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeRepositoriesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeRepositoryFilterPersonalRequest struct { + *tchttp.BaseRequest + + // 搜索镜像名 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 偏移量,默认为0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 返回最大数量,默认 20,最大100 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 筛选条件:1表示public,0表示private + Public *int64 `json:"Public,omitempty" name:"Public"` + + // 命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` +} + +func (r *DescribeRepositoryFilterPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeRepositoryFilterPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeRepositoryFilterPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 仓库信息 + Data *SearchUserRepositoryResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeRepositoryFilterPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeRepositoryFilterPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeRepositoryOwnerPersonalRequest struct { + *tchttp.BaseRequest + + // 偏移量,默认为0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 返回最大数量,默认 20, 最大值 100 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` +} + +func (r *DescribeRepositoryOwnerPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeRepositoryOwnerPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeRepositoryOwnerPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 仓库信息 + Data *RepoInfoResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeRepositoryOwnerPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeRepositoryOwnerPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeRepositoryPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名字 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` +} + +func (r *DescribeRepositoryPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeRepositoryPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeRepositoryPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 仓库信息 + Data *RepositoryInfoResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeRepositoryPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeRepositoryPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeUserQuotaPersonalRequest struct { + *tchttp.BaseRequest +} + +func (r *DescribeUserQuotaPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeUserQuotaPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeUserQuotaPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 配额返回信息 + Data *RespLimit `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeUserQuotaPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeUserQuotaPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeWebhookTriggerLogRequest struct { + *tchttp.BaseRequest + + // 实例 Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // 触发器 Id + Id *int64 `json:"Id,omitempty" name:"Id"` + + // 分页单页数量 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 分页偏移量 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` +} + +func (r *DescribeWebhookTriggerLogRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeWebhookTriggerLogRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeWebhookTriggerLogResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 日志列表 + Logs []*WebhookTriggerLog `json:"Logs,omitempty" name:"Logs" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeWebhookTriggerLogResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeWebhookTriggerLogResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeWebhookTriggerRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 分页单页数量 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 分页偏移量 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` +} + +func (r *DescribeWebhookTriggerRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeWebhookTriggerRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeWebhookTriggerResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 触发器总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 触发器列表 + Triggers []*WebhookTrigger `json:"Triggers,omitempty" name:"Triggers" list` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeWebhookTriggerResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DescribeWebhookTriggerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DupImageTagResp struct { + + // 镜像Digest值 + Digest *string `json:"Digest,omitempty" name:"Digest"` +} + +type DuplicateImagePersonalRequest struct { + *tchttp.BaseRequest + + // 源镜像名称,不包含domain。例如: tencentyun/foo:v1 + SrcImage *string `json:"SrcImage,omitempty" name:"SrcImage"` + + // 目的镜像名称,不包含domain。例如: tencentyun/foo:latest + DestImage *string `json:"DestImage,omitempty" name:"DestImage"` +} + +func (r *DuplicateImagePersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DuplicateImagePersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DuplicateImagePersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 复制镜像返回值 + Data *DupImageTagResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DuplicateImagePersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *DuplicateImagePersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type FavorResp struct { + + // 收藏仓库的总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 仓库信息数组 + // 注意:此字段可能返回 null,表示取不到有效值。 + RepoInfo []*Favors `json:"RepoInfo,omitempty" name:"RepoInfo" list` +} + +type Favors struct { + + // 仓库名字 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 仓库类型 + RepoType *string `json:"RepoType,omitempty" name:"RepoType"` + + // Pull总共的次数 + // 注意:此字段可能返回 null,表示取不到有效值。 + PullCount *int64 `json:"PullCount,omitempty" name:"PullCount"` + + // 仓库收藏次数 + // 注意:此字段可能返回 null,表示取不到有效值。 + FavorCount *int64 `json:"FavorCount,omitempty" name:"FavorCount"` + + // 仓库是否公开 + // 注意:此字段可能返回 null,表示取不到有效值。 + Public *int64 `json:"Public,omitempty" name:"Public"` + + // 是否为官方所有 + // 注意:此字段可能返回 null,表示取不到有效值。 + IsQcloudOfficial *bool `json:"IsQcloudOfficial,omitempty" name:"IsQcloudOfficial"` + + // 仓库Tag的数量 + // 注意:此字段可能返回 null,表示取不到有效值。 + TagCount *int64 `json:"TagCount,omitempty" name:"TagCount"` + + // Logo + // 注意:此字段可能返回 null,表示取不到有效值。 + Logo *string `json:"Logo,omitempty" name:"Logo"` + + // 地域 + Region *string `json:"Region,omitempty" name:"Region"` + + // 地域的Id + RegionId *int64 `json:"RegionId,omitempty" name:"RegionId"` +} + +type Filter struct { + + // 属性名称, 若存在多个Filter时,Filter间的关系为逻辑与(AND)关系。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 属性值, 若同一个Filter存在多个Values,同一Filter下Values间的关系为逻辑或(OR)关系。 + Values []*string `json:"Values,omitempty" name:"Values" list` +} + +type Header struct { + + // Header Key + Key *string `json:"Key,omitempty" name:"Key"` + + // Header Values + Values []*string `json:"Values,omitempty" name:"Values" list` +} + +type Limit struct { + + // 用户名 + Username *string `json:"Username,omitempty" name:"Username"` + + // 配额的类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 配置的值 + Value *int64 `json:"Value,omitempty" name:"Value"` +} + +type ManageImageLifecycleGlobalPersonalRequest struct { + *tchttp.BaseRequest + + // global_keep_last_days:全局保留最近几天的数据;global_keep_last_nums:全局保留最近多少个 + Type *string `json:"Type,omitempty" name:"Type"` + + // 策略值 + Val *int64 `json:"Val,omitempty" name:"Val"` +} + +func (r *ManageImageLifecycleGlobalPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ManageImageLifecycleGlobalPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ManageImageLifecycleGlobalPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ManageImageLifecycleGlobalPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ManageImageLifecycleGlobalPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyApplicationTriggerPersonalRequest struct { + *tchttp.BaseRequest + + // 触发器关联的镜像仓库,library/test格式 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 触发器名称 + TriggerName *string `json:"TriggerName,omitempty" name:"TriggerName"` + + // 触发方式,"all"全部触发,"taglist"指定tag触发,"regex"正则触发 + InvokeMethod *string `json:"InvokeMethod,omitempty" name:"InvokeMethod"` + + // 触发方式对应的表达式 + InvokeExpr *string `json:"InvokeExpr,omitempty" name:"InvokeExpr"` + + // 应用所在TKE集群ID + ClusterId *string `json:"ClusterId,omitempty" name:"ClusterId"` + + // 应用所在TKE集群命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // 应用所在TKE集群工作负载类型,支持Deployment、StatefulSet、DaemonSet、CronJob、Job。 + WorkloadType *string `json:"WorkloadType,omitempty" name:"WorkloadType"` + + // 应用所在TKE集群工作负载名称 + WorkloadName *string `json:"WorkloadName,omitempty" name:"WorkloadName"` + + // 应用所在TKE集群工作负载下容器名称 + ContainerName *string `json:"ContainerName,omitempty" name:"ContainerName"` + + // 应用所在TKE集群地域数字ID,如1(广州)、16(成都) + ClusterRegion *int64 `json:"ClusterRegion,omitempty" name:"ClusterRegion"` + + // 新触发器名称 + NewTriggerName *string `json:"NewTriggerName,omitempty" name:"NewTriggerName"` +} + +func (r *ModifyApplicationTriggerPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyApplicationTriggerPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyApplicationTriggerPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyApplicationTriggerPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyApplicationTriggerPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyInstanceTokenRequest struct { + *tchttp.BaseRequest + + // 实例长期访问凭证 ID + TokenId *string `json:"TokenId,omitempty" name:"TokenId"` + + // 启用或禁用实例长期访问凭证 + Enable *bool `json:"Enable,omitempty" name:"Enable"` + + // 实例 ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` +} + +func (r *ModifyInstanceTokenRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyInstanceTokenRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyInstanceTokenResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyInstanceTokenResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyInstanceTokenResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyNamespaceRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 访问级别,True为公开,False为私有 + IsPublic *bool `json:"IsPublic,omitempty" name:"IsPublic"` +} + +func (r *ModifyNamespaceRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyNamespaceRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyNamespaceResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyNamespaceResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyNamespaceResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyRepositoryAccessPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 默认值为0 + Public *int64 `json:"Public,omitempty" name:"Public"` +} + +func (r *ModifyRepositoryAccessPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyRepositoryAccessPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyRepositoryAccessPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyRepositoryAccessPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyRepositoryAccessPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyRepositoryInfoPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 仓库描述 + Description *string `json:"Description,omitempty" name:"Description"` +} + +func (r *ModifyRepositoryInfoPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyRepositoryInfoPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyRepositoryInfoPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyRepositoryInfoPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyRepositoryInfoPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyRepositoryRequest struct { + *tchttp.BaseRequest + + // 实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 命名空间名称 + NamespaceName *string `json:"NamespaceName,omitempty" name:"NamespaceName"` + + // 镜像仓库名称 + RepositoryName *string `json:"RepositoryName,omitempty" name:"RepositoryName"` + + // 仓库简短描述 + BriefDescription *string `json:"BriefDescription,omitempty" name:"BriefDescription"` + + // 仓库详细描述 + Description *string `json:"Description,omitempty" name:"Description"` +} + +func (r *ModifyRepositoryRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyRepositoryRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyRepositoryResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyRepositoryResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyRepositoryResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyUserPasswordPersonalRequest struct { + *tchttp.BaseRequest + + // 更新后的密码 + Password *string `json:"Password,omitempty" name:"Password"` +} + +func (r *ModifyUserPasswordPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyUserPasswordPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyUserPasswordPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyUserPasswordPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyUserPasswordPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyWebhookTriggerRequest struct { + *tchttp.BaseRequest + + // 实例Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 触发器参数 + Trigger *WebhookTrigger `json:"Trigger,omitempty" name:"Trigger"` + + // 命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` +} + +func (r *ModifyWebhookTriggerRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyWebhookTriggerRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ModifyWebhookTriggerResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ModifyWebhookTriggerResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ModifyWebhookTriggerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type NamespaceInfo struct { + + // 命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // 创建时间 + CreationTime *string `json:"CreationTime,omitempty" name:"CreationTime"` + + // 命名空间下仓库数量 + RepoCount *int64 `json:"RepoCount,omitempty" name:"RepoCount"` +} + +type NamespaceInfoResp struct { + + // 命名空间数量 + NamespaceCount *int64 `json:"NamespaceCount,omitempty" name:"NamespaceCount"` + + // 命名空间信息 + NamespaceInfo []*NamespaceInfo `json:"NamespaceInfo,omitempty" name:"NamespaceInfo" list` +} + +type NamespaceIsExistsResp struct { + + // 命名空间是否存在 + IsExist *bool `json:"IsExist,omitempty" name:"IsExist"` + + // 是否为保留命名空间 + IsPreserved *bool `json:"IsPreserved,omitempty" name:"IsPreserved"` +} + +type Registry struct { + + // 实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 实例名称 + RegistryName *string `json:"RegistryName,omitempty" name:"RegistryName"` + + // 实例规格 + RegistryType *string `json:"RegistryType,omitempty" name:"RegistryType"` + + // 实例状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // 实例的公共访问地址 + PublicDomain *string `json:"PublicDomain,omitempty" name:"PublicDomain"` + + // 实例创建时间 + CreatedAt *string `json:"CreatedAt,omitempty" name:"CreatedAt"` + + // 地域名称 + RegionName *string `json:"RegionName,omitempty" name:"RegionName"` + + // 地域Id + RegionId *uint64 `json:"RegionId,omitempty" name:"RegionId"` + + // 是否支持匿名 + EnableAnonymous *bool `json:"EnableAnonymous,omitempty" name:"EnableAnonymous"` + + // Token有效时间 + TokenValidTime *uint64 `json:"TokenValidTime,omitempty" name:"TokenValidTime"` + + // 实例内部访问地址 + InternalEndpoint *string `json:"InternalEndpoint,omitempty" name:"InternalEndpoint"` + + // 实例云标签 + // 注意:此字段可能返回 null,表示取不到有效值。 + TagSpecification *TagSpecification `json:"TagSpecification,omitempty" name:"TagSpecification"` +} + +type RegistryCondition struct { + + // 实例创建过程类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 实例创建过程状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // 转换到该过程的简明原因 + // 注意:此字段可能返回 null,表示取不到有效值。 + Reason *string `json:"Reason,omitempty" name:"Reason"` +} + +type RegistryStatus struct { + + // 实例的Id + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 实例的状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // 附加状态 + // 注意:此字段可能返回 null,表示取不到有效值。 + Conditions []*RegistryCondition `json:"Conditions,omitempty" name:"Conditions" list` +} + +type ReplicationRegistry struct { + + // 主实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 复制实例ID + ReplicationRegistryId *string `json:"ReplicationRegistryId,omitempty" name:"ReplicationRegistryId"` + + // 复制实例的地域ID + ReplicationRegionId *uint64 `json:"ReplicationRegionId,omitempty" name:"ReplicationRegionId"` + + // 复制实例的地域名称 + ReplicationRegionName *string `json:"ReplicationRegionName,omitempty" name:"ReplicationRegionName"` + + // 复制实例的状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // 创建时间 + CreatedAt *string `json:"CreatedAt,omitempty" name:"CreatedAt"` +} + +type RepoInfo struct { + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 仓库类型 + RepoType *string `json:"RepoType,omitempty" name:"RepoType"` + + // Tag数量 + TagCount *int64 `json:"TagCount,omitempty" name:"TagCount"` + + // 是否为公开 + Public *int64 `json:"Public,omitempty" name:"Public"` + + // 是否为用户收藏 + IsUserFavor *bool `json:"IsUserFavor,omitempty" name:"IsUserFavor"` + + // 是否为腾讯云官方仓库 + IsQcloudOfficial *bool `json:"IsQcloudOfficial,omitempty" name:"IsQcloudOfficial"` + + // 被收藏的个数 + FavorCount *int64 `json:"FavorCount,omitempty" name:"FavorCount"` + + // 拉取的数量 + PullCount *int64 `json:"PullCount,omitempty" name:"PullCount"` + + // 描述 + Description *string `json:"Description,omitempty" name:"Description"` + + // 仓库创建时间 + CreationTime *string `json:"CreationTime,omitempty" name:"CreationTime"` + + // 仓库更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` +} + +type RepoInfoResp struct { + + // 仓库总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 仓库信息列表 + RepoInfo []*RepoInfo `json:"RepoInfo,omitempty" name:"RepoInfo" list` + + // Server信息 + Server *string `json:"Server,omitempty" name:"Server"` +} + +type RepoIsExistResp struct { + + // 仓库是否存在 + IsExist *bool `json:"IsExist,omitempty" name:"IsExist"` +} + +type RepositoryInfoResp struct { + + // 镜像仓库名字 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // 镜像仓库类型 + RepoType *string `json:"RepoType,omitempty" name:"RepoType"` + + // 镜像仓库服务地址 + Server *string `json:"Server,omitempty" name:"Server"` + + // 创建时间 + CreationTime *string `json:"CreationTime,omitempty" name:"CreationTime"` + + // 镜像仓库描述 + // 注意:此字段可能返回 null,表示取不到有效值。 + Description *string `json:"Description,omitempty" name:"Description"` + + // 是否为公有镜像 + Public *int64 `json:"Public,omitempty" name:"Public"` + + // 下载次数 + PullCount *int64 `json:"PullCount,omitempty" name:"PullCount"` + + // 收藏次数 + FavorCount *int64 `json:"FavorCount,omitempty" name:"FavorCount"` + + // 是否为用户收藏 + IsUserFavor *bool `json:"IsUserFavor,omitempty" name:"IsUserFavor"` + + // 是否为腾讯云官方镜像 + IsQcloudOfficial *bool `json:"IsQcloudOfficial,omitempty" name:"IsQcloudOfficial"` +} + +type RespLimit struct { + + // 配额信息 + LimitInfo []*Limit `json:"LimitInfo,omitempty" name:"LimitInfo" list` +} + +type SameImagesResp struct { + + // tag列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + SameImages []*string `json:"SameImages,omitempty" name:"SameImages" list` +} + +type SearchUserRepositoryResp struct { + + // 总个数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 仓库列表 + RepoInfo []*RepoInfo `json:"RepoInfo,omitempty" name:"RepoInfo" list` + + // Server + Server *string `json:"Server,omitempty" name:"Server"` + + // PrivilegeFiltered + PrivilegeFiltered *bool `json:"PrivilegeFiltered,omitempty" name:"PrivilegeFiltered"` +} + +type Tag struct { + + // 云标签的key + Key *string `json:"Key,omitempty" name:"Key"` + + // 云标签的值 + Value *string `json:"Value,omitempty" name:"Value"` +} + +type TagInfo struct { + + // Tag名称 + TagName *string `json:"TagName,omitempty" name:"TagName"` + + // 镜像Id + TagId *string `json:"TagId,omitempty" name:"TagId"` + + // docker image 可以看到的id + ImageId *string `json:"ImageId,omitempty" name:"ImageId"` + + // 大小 + Size *string `json:"Size,omitempty" name:"Size"` + + // 镜像的创建时间 + CreationTime *string `json:"CreationTime,omitempty" name:"CreationTime"` + + // 镜像创建至今时间长度 + // 注意:此字段可能返回 null,表示取不到有效值。 + DurationDays *string `json:"DurationDays,omitempty" name:"DurationDays"` + + // 镜像的作者 + Author *string `json:"Author,omitempty" name:"Author"` + + // 次镜像建议运行的系统架构 + Architecture *string `json:"Architecture,omitempty" name:"Architecture"` + + // 创建此镜像的docker版本 + DockerVersion *string `json:"DockerVersion,omitempty" name:"DockerVersion"` + + // 此镜像建议运行系统 + OS *string `json:"OS,omitempty" name:"OS"` + + // SizeByte + SizeByte *int64 `json:"SizeByte,omitempty" name:"SizeByte"` + + // Id + Id *int64 `json:"Id,omitempty" name:"Id"` + + // 数据更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 镜像更新时间 + PushTime *string `json:"PushTime,omitempty" name:"PushTime"` +} + +type TagInfoResp struct { + + // Tag的总数 + TagCount *int64 `json:"TagCount,omitempty" name:"TagCount"` + + // TagInfo列表 + TagInfo []*TagInfo `json:"TagInfo,omitempty" name:"TagInfo" list` + + // Server + Server *string `json:"Server,omitempty" name:"Server"` + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` +} + +type TagSpecification struct { + + // 默认值为instance + // 注意:此字段可能返回 null,表示取不到有效值。 + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` + + // 云标签数组 + // 注意:此字段可能返回 null,表示取不到有效值。 + Tags []*Tag `json:"Tags,omitempty" name:"Tags" list` +} + +type TaskDetail struct { + + // 任务 + TaskName *string `json:"TaskName,omitempty" name:"TaskName"` + + // 任务UUID + TaskUUID *string `json:"TaskUUID,omitempty" name:"TaskUUID"` + + // 任务状态 + TaskStatus *string `json:"TaskStatus,omitempty" name:"TaskStatus"` + + // 任务的状态信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + TaskMessage *string `json:"TaskMessage,omitempty" name:"TaskMessage"` + + // 任务开始时间 + CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"` + + // 任务结束时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + FinishedTime *string `json:"FinishedTime,omitempty" name:"FinishedTime"` +} + +type TcrImageInfo struct { + + // 哈希值 + Digest *string `json:"Digest,omitempty" name:"Digest"` + + // 镜像大小 + Size *int64 `json:"Size,omitempty" name:"Size"` + + // Tag名称 + ImageVersion *string `json:"ImageVersion,omitempty" name:"ImageVersion"` + + // 更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` +} + +type TcrInstanceToken struct { + + // 令牌ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 令牌描述 + Desc *string `json:"Desc,omitempty" name:"Desc"` + + // 令牌所属实例ID + RegistryId *string `json:"RegistryId,omitempty" name:"RegistryId"` + + // 令牌启用状态 + Enabled *bool `json:"Enabled,omitempty" name:"Enabled"` + + // 令牌创建时间 + CreatedAt *string `json:"CreatedAt,omitempty" name:"CreatedAt"` + + // 令牌过期时间戳 + ExpiredAt *int64 `json:"ExpiredAt,omitempty" name:"ExpiredAt"` +} + +type TcrNamespaceInfo struct { + + // 命名空间名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 创建时间 + CreationTime *string `json:"CreationTime,omitempty" name:"CreationTime"` + + // 访问级别 + Public *bool `json:"Public,omitempty" name:"Public"` + + // 命名空间的Id + NamespaceId *int64 `json:"NamespaceId,omitempty" name:"NamespaceId"` +} + +type TcrRepositoryInfo struct { + + // 仓库名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 命名空间名称 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // 创建时间 + CreationTime *string `json:"CreationTime,omitempty" name:"CreationTime"` + + // 是否公开 + Public *bool `json:"Public,omitempty" name:"Public"` + + // 仓库详细描述 + // 注意:此字段可能返回 null,表示取不到有效值。 + Description *string `json:"Description,omitempty" name:"Description"` + + // 简单描述 + // 注意:此字段可能返回 null,表示取不到有效值。 + BriefDescription *string `json:"BriefDescription,omitempty" name:"BriefDescription"` + + // 更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` +} + +type TriggerInvokeCondition struct { + + // 触发方式 + InvokeMethod *string `json:"InvokeMethod,omitempty" name:"InvokeMethod"` + + // 触发表达式 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeExpr *string `json:"InvokeExpr,omitempty" name:"InvokeExpr"` +} + +type TriggerInvokePara struct { + + // AppId + // 注意:此字段可能返回 null,表示取不到有效值。 + AppId *string `json:"AppId,omitempty" name:"AppId"` + + // TKE集群ID + // 注意:此字段可能返回 null,表示取不到有效值。 + ClusterId *string `json:"ClusterId,omitempty" name:"ClusterId"` + + // TKE集群命名空间 + // 注意:此字段可能返回 null,表示取不到有效值。 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // TKE集群工作负载名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + ServiceName *string `json:"ServiceName,omitempty" name:"ServiceName"` + + // TKE集群工作负载中容器名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + ContainerName *string `json:"ContainerName,omitempty" name:"ContainerName"` + + // TKE集群地域数字ID + // 注意:此字段可能返回 null,表示取不到有效值。 + ClusterRegion *int64 `json:"ClusterRegion,omitempty" name:"ClusterRegion"` +} + +type TriggerInvokeResult struct { + + // 请求TKE返回值 + // 注意:此字段可能返回 null,表示取不到有效值。 + ReturnCode *int64 `json:"ReturnCode,omitempty" name:"ReturnCode"` + + // 请求TKE返回信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + ReturnMsg *string `json:"ReturnMsg,omitempty" name:"ReturnMsg"` +} + +type TriggerLogResp struct { + + // 仓库名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` + + // Tag名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + TagName *string `json:"TagName,omitempty" name:"TagName"` + + // 触发器名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + TriggerName *string `json:"TriggerName,omitempty" name:"TriggerName"` + + // 触发方式 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeSource *string `json:"InvokeSource,omitempty" name:"InvokeSource"` + + // 触发动作 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeAction *string `json:"InvokeAction,omitempty" name:"InvokeAction"` + + // 触发时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeTime *string `json:"InvokeTime,omitempty" name:"InvokeTime"` + + // 触发条件 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeCondition *TriggerInvokeCondition `json:"InvokeCondition,omitempty" name:"InvokeCondition"` + + // 触发参数 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokePara *TriggerInvokePara `json:"InvokePara,omitempty" name:"InvokePara"` + + // 触发结果 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeResult *TriggerInvokeResult `json:"InvokeResult,omitempty" name:"InvokeResult"` +} + +type TriggerResp struct { + + // 触发器名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + TriggerName *string `json:"TriggerName,omitempty" name:"TriggerName"` + + // 触发来源 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeSource *string `json:"InvokeSource,omitempty" name:"InvokeSource"` + + // 触发动作 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeAction *string `json:"InvokeAction,omitempty" name:"InvokeAction"` + + // 创建时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"` + + // 更新时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 触发条件 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokeCondition *TriggerInvokeCondition `json:"InvokeCondition,omitempty" name:"InvokeCondition"` + + // 触发器参数 + // 注意:此字段可能返回 null,表示取不到有效值。 + InvokePara *TriggerInvokePara `json:"InvokePara,omitempty" name:"InvokePara"` +} + +type ValidateNamespaceExistPersonalRequest struct { + *tchttp.BaseRequest + + // 命名空间名称 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` +} + +func (r *ValidateNamespaceExistPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ValidateNamespaceExistPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ValidateNamespaceExistPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 命名空间是否存在 + Data *NamespaceIsExistsResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ValidateNamespaceExistPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ValidateNamespaceExistPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ValidateRepositoryExistPersonalRequest struct { + *tchttp.BaseRequest + + // 仓库名称 + RepoName *string `json:"RepoName,omitempty" name:"RepoName"` +} + +func (r *ValidateRepositoryExistPersonalRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ValidateRepositoryExistPersonalRequest) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ValidateRepositoryExistPersonalResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 仓库是否存在 + Data *RepoIsExistResp `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *ValidateRepositoryExistPersonalResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +func (r *ValidateRepositoryExistPersonalResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type WebhookTarget struct { + + // 目标地址 + Address *string `json:"Address,omitempty" name:"Address"` + + // 自定义 Headers + Headers []*Header `json:"Headers,omitempty" name:"Headers" list` +} + +type WebhookTrigger struct { + + // 触发器名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 触发器目标 + Targets []*WebhookTarget `json:"Targets,omitempty" name:"Targets" list` + + // 触发动作 + EventTypes []*string `json:"EventTypes,omitempty" name:"EventTypes" list` + + // 触发规则 + Condition *string `json:"Condition,omitempty" name:"Condition"` + + // 启用触发器 + Enabled *bool `json:"Enabled,omitempty" name:"Enabled"` + + // 触发器Id + Id *int64 `json:"Id,omitempty" name:"Id"` + + // 触发器描述 + Description *string `json:"Description,omitempty" name:"Description"` + + // 触发器所属命名空间 Id + NamespaceId *int64 `json:"NamespaceId,omitempty" name:"NamespaceId"` +} + +type WebhookTriggerLog struct { + + // 日志 Id + Id *int64 `json:"Id,omitempty" name:"Id"` + + // 触发器 Id + TriggerId *int64 `json:"TriggerId,omitempty" name:"TriggerId"` + + // 事件类型 + EventType *string `json:"EventType,omitempty" name:"EventType"` + + // 通知类型 + NotifyType *string `json:"NotifyType,omitempty" name:"NotifyType"` + + // 详情 + Detail *string `json:"Detail,omitempty" name:"Detail"` + + // 创建时间 + CreationTime *string `json:"CreationTime,omitempty" name:"CreationTime"` + + // 更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 状态 + Status *string `json:"Status,omitempty" name:"Status"` +} diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 145a47419..e8791667f 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -474,6 +474,14 @@ github.com/stretchr/testify/assert github.com/stretchr/testify/mock github.com/stretchr/testify/require github.com/stretchr/testify/suite +# github.com/tencentcloud/tencentcloud-sdk-go v1.0.62 +## explicit +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/regions +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924 # github.com/theupdateframework/notary v0.6.1 ## explicit github.com/theupdateframework/notary