-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provisioner): provisioner server implementation (#18)
* test(provisioner): prepare base unit tests Signed-off-by: Mateusz Urbanek <[email protected]> * feat(provisioner): added server side calls Signed-off-by: Mateusz Urbanek <[email protected]> * test(provisioner): fixed and extended units Signed-off-by: Mateusz Urbanek <[email protected]> * fix(examples): set correct cluster in the example Signed-off-by: Mateusz Urbanek <[email protected]> * test(provisioner): added integration tests Signed-off-by: Mateusz Urbanek <[email protected]> * docs(readme): added basic usage Signed-off-by: Mateusz Urbanek <[email protected]> * fix(review/1): include error in the error log Signed-off-by: Mateusz Urbanek <[email protected]> * fix(review/2): check for span nillnes Signed-off-by: Mateusz Urbanek <[email protected]> * fix(review/2): invert logic in CreateBucket Signed-off-by: Mateusz Urbanek <[email protected]> --------- Signed-off-by: Mateusz Urbanek <[email protected]>
- Loading branch information
1 parent
0042442
commit de570f7
Showing
17 changed files
with
948 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright 2023 Akamai Technologies, Inc. | ||
// | ||
// 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 provisioner | ||
|
||
import ( | ||
"errors" | ||
"net/http" | ||
|
||
"github.com/linode/linodego" | ||
) | ||
|
||
const ( | ||
ParamRegion = "cosi.linode.com/v1/region" | ||
ParamACL = "cosi.linode.com/v1/acl" | ||
ParamCORS = "cosi.linode.com/v1/cors" | ||
ParamPermissions = "cosi.linode.com/v1/permissions" | ||
) | ||
|
||
type ParamCORSValue string | ||
|
||
const ( | ||
ParamCORSValueEnabled ParamCORSValue = "enabled" | ||
ParamCORSValueDisabled ParamCORSValue = "disabled" | ||
) | ||
|
||
func (v ParamCORSValue) Bool() bool { | ||
return v == ParamCORSValueEnabled | ||
} | ||
|
||
func (v ParamCORSValue) BoolP() *bool { | ||
p := v == ParamCORSValueEnabled | ||
return &p | ||
} | ||
|
||
type ParamPermissionsValue string | ||
|
||
const ( | ||
ParamPermissionsValueReadOnly ParamPermissionsValue = "read_only" | ||
ParamPermissionsValueReadWrite ParamPermissionsValue = "read_write" | ||
) | ||
|
||
const ( | ||
S3 = "s3" | ||
S3Region = "region" | ||
S3Endpoint = "endpoint" | ||
S3SecretAccessKeyID = "accessKeyID" | ||
S3SecretAccessSecretKey = "accessSecretKey" | ||
) | ||
|
||
var ( | ||
ErrNotFound = linodego.Error{Code: http.StatusNotFound} | ||
ErrBucketExists = errors.New("bucket exists with different parameters") | ||
ErrUnsuportedAuth = errors.New("unsupported authentication schema") | ||
ErrMissingRegion = errors.New("region was not provided") | ||
ErrUnknownPermsissions = errors.New("unknown permissions") | ||
) | ||
|
||
const ( | ||
KeyBucketID = "bucket.id" | ||
KeyBucketLabel = "bucket.label" | ||
KeyBucketCluster = "bucket.cluster" | ||
KeyBucketCreationTimestamp = "bucket.created_at" | ||
KeyBucketACL = "bucket.acl" | ||
KeyBucketCORS = "bucket.cors_enabled" | ||
KeyBucketAccessIDRaw = "bucket.access.id_raw" | ||
KeyBucketAccessID = "bucket.access.id" | ||
KeyBucketAccessName = "bucket.access.name" | ||
KeyBucketAccessAuth = "bucket.access.auth" | ||
KeyBucketAccessPermissions = "bucket.access.permissions" | ||
) |
Oops, something went wrong.