Skip to content

Commit

Permalink
release v1.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
contabo committed Mar 8, 2024
1 parent d1bbc12 commit 266ca37
Show file tree
Hide file tree
Showing 229 changed files with 10,232 additions and 10,014 deletions.
8 changes: 6 additions & 2 deletions cmd/objects/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,18 @@ func PutObject(localPath string, isDir bool, s3Prefix string, s3Client *minio.Cl
defer object.Close()

objectStat, err := object.Stat()

if err != nil {
log.Fatal(fmt.Sprintf("Could not read file properties %v. Got error %v", localPath, err))
}

_, err = s3Client.PutObject(context.Background(), createObjectBucketName, s3Path, object, objectStat.Size(), minio.PutObjectOptions{ContentType: "application/octet-stream"})
_, err = s3Client.FPutObject(context.Background(), createObjectBucketName, objectStat.Name(), s3Path, minio.PutObjectOptions{ContentType: "application/octet-stream"})

if err != nil {
if s.Contains(err.Error(), "API rate limit exceeded") { // retry in case of rate limit exceeded eror
time.Sleep(1000 * time.Millisecond)
_, err = s3Client.PutObject(context.Background(), createObjectBucketName, s3Path, object, objectStat.Size(), minio.PutObjectOptions{ContentType: "application/octet-stream"})
_, err = s3Client.FPutObject(context.Background(), createObjectBucketName, objectStat.Name(), s3Path, minio.PutObjectOptions{ContentType: "application/octet-stream"})

if err != nil {
log.Fatal(fmt.Sprintf("Could not create object file %v. Got error %v", s3Path, err))
}
Expand All @@ -80,6 +82,7 @@ func PutObject(localPath string, isDir bool, s3Prefix string, s3Client *minio.Cl
}

_, err := s3Client.PutObject(context.Background(), createObjectBucketName, s3Path, nil, 0, minio.PutObjectOptions{})

if err != nil {
if s.Contains(err.Error(), "API rate limit exceeded") { // retry in case of rate limit exceeded eror
time.Sleep(1000 * time.Millisecond)
Expand Down Expand Up @@ -138,6 +141,7 @@ var objectCreateCmd = &cobra.Command{
),
Secure: true,
})

if err != nil {
log.Fatal(fmt.Sprintf("Error in connecting to S3 Client . Got error %v", err))
}
Expand Down
46 changes: 40 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,59 @@
module contabo.com/cli/cntb

go 1.16
go 1.21

toolchain go1.22.0

require (
contabo.com/cli/cntb/openapi v0.0.0-00010101000000-000000000000
github.com/PaesslerAG/gval v1.1.2 // indirect
github.com/PaesslerAG/jsonpath v0.1.1
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hprose/hprose-go v0.0.0-20161031134501-83de97da5004
github.com/minio/minio-go/v7 v7.0.23
github.com/minio/minio-go/v7 v7.0.68
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.8.1
github.com/sirupsen/logrus v1.9.2
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.9.0
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f
gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.3.0
)

require (
github.com/PaesslerAG/gval v1.1.2 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)

replace contabo.com/cli/cntb/openapi => ./openapi
70 changes: 35 additions & 35 deletions go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions openapi/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gitignore
.openapi-generator-ignore
.travis.yml
README.md
api/openapi.yaml
Expand Down
4 changes: 4 additions & 0 deletions openapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Invoke-WebRequest -Uri 'https://api.contabo.com/v1/compute/instances' -Method 'G




```sh
cntb config set-credentials --oauth2-clientid=<ClientId from Customer Control Panel> --oauth2-client-secret=<ClientSecret from Customer Control Panel> --oauth2-user=<API User from Customer Control Panel> --oauth2-password='<API Password from Customer Control Panel>'
```
Expand All @@ -94,6 +95,7 @@ Invoke-WebRequest -Uri 'https://api.contabo.com/v1/compute/instances' -Method 'G




```sh
# get list of your instances
cntb get instances
Expand Down Expand Up @@ -147,6 +149,7 @@ If you need to allow other persons or automation scripts to access specific API




This allows you to specify a restriction to certain functions of an API by allowing control over POST (=Create), GET (=Read), PUT/PATCH (=Update) and DELETE (=Delete) methods for each API endpoint (URL) individually.
* `resourcePermission`

Expand All @@ -159,6 +162,7 @@ If you need to allow other persons or automation scripts to access specific API




In order to restrict access to specific resources create a role with `resourcePermission` type by specifying any number of [tags](#tag-management). These tags need to be assigned to resources for them to take effect. E.g. a tag could be assigned to several compute resources. So that a user with that role (and of course access to the API endpoints via `apiPermission` role type) could only access those compute resources.

The `roles` are then assigned to a `user`. You can assign one or several roles regardless of the role's type. Of course you could also assign a user `admin` privileges without specifying any roles.
Expand Down
Loading

0 comments on commit 266ca37

Please sign in to comment.