Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/actions/setup-smithy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ runs:
steps:
- name: Install Smithy CLI
shell: bash
env:
SMITHY_VERSION: '1.61.0'
run: |
# Extract Smithy version from smithy-build.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related with the pr, but this is nicer as we will only have one source of truth for smithy version.
I could definitely see someone updating smithy version here and forgetting about updating it in smithy-build.json

SMITHY_VERSION=$(jq -r '.maven.dependencies[] | select(contains("smithy-aws-traits")) | split(":")[2]' smithy-build.json)
echo "Installing Smithy CLI version ${SMITHY_VERSION}"
mkdir -p smithy-install/smithy
curl -L https://github.com/smithy-lang/smithy/releases/download/${SMITHY_VERSION}/smithy-cli-linux-x86_64.zip -o smithy-install/smithy-cli-linux-x86_64.zip
unzip -qo smithy-install/smithy-cli-linux-x86_64.zip -d smithy-install
Expand Down
2 changes: 1 addition & 1 deletion .github/docker-compose.cloudserver-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- ./md-config.json:/mnt/standalone_workdir/config.json:ro

cloudserver-metadata:
image: ghcr.io/scality/cloudserver:9.1.4
image: ghcr.io/scality/cloudserver:9.3.0-preview.1
platform: linux/amd64
network_mode: 'host'
environment:
Expand Down
2 changes: 1 addition & 1 deletion .github/docker-compose.cloudserver-mongo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
restart: "no"

cloudserver:
image: ghcr.io/scality/cloudserver:9.1.4
image: ghcr.io/scality/cloudserver:9.3.0-preview.1
platform: linux/amd64
ports:
- "8000:8000"
Expand Down
47 changes: 47 additions & 0 deletions examples/bucketQuota.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
BucketQuotaClient,
CloudserverBucketQuotaClientConfig,
GetBucketQuotaCommand
} from '@scality/cloudserverclient/clients/bucketQuota';

const config: CloudserverBucketQuotaClientConfig = {
endpoint: 'http://localhost:8000',
credentials: {
accessKeyId: 'accessKey1',
secretAccessKey: 'verySecretKey1',
},
region: 'us-east-1',
maxAttempts: 1,
};

const bucketQuotaClient = new BucketQuotaClient(config);
try {
const getBucketQuotaCommand = new GetBucketQuotaCommand({
Bucket: 'aBucketName',
});

const quotaData = await bucketQuotaClient.send(getBucketQuotaCommand);
// {
// "$metadata": {
// "httpStatusCode": 200,
// "requestId": "aa0681fd844c9a2272fa",
// "extendedRequestId": "aa0681fd844c9a2272fa",
// "attempts": 1,
// "totalRetryDelay": 0
// },
// "Name": "aBucketName",
// "Quota": 42
// }
} catch (error: any) {
console.error(error.name); // NoSuchBucket
console.error(error.message); // The specified bucket does not exist.
// {
// httpStatusCode: 404,
// requestId: "0caf000bc140bb9e62e9",
// extendedRequestId: "0caf000bc140bb9e62e9",
// cfId: undefined,
// attempts: 1,
// totalRetryDelay: 0,
// }
console.error(error.$metadata);
}
27 changes: 27 additions & 0 deletions examples/cloudserverClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// cloudserverClient is a meta client that imports all other clients.
// In this library, you can either use individual clients (like BackbeatRoutesClient or BucketQuotaClient),
// or use this global client.

import {
CloudserverClient,
CloudserverClientConfig,
GetObjectCommand
} from '@scality/cloudserverclient';

const command = new GetObjectCommand({
Bucket: 'aBucketName',
Key: 'anObjectKey',
});

const config: CloudserverClientConfig = {
endpoint: 'http://localhost:8000',
credentials: {
accessKeyId: 'accessKey1',
secretAccessKey: 'verySecretKey1',
},
region: 'us-east-1',
};
const client = new CloudserverClient(config);

const getData = await client.backbeatRoutes.send(command);
const bodyStr = await getData.Body.transformToString();
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@idempotent
@http(method: "POST", uri: "/_/backbeat/batchdelete/{Bucket}/{Key+}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Streaming blob type for binary data transfer
@streaming
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@http(method: "POST", uri: "/_/backbeat/index/{Bucket}?operation=delete")
@idempotent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@idempotent
@http(method: "DELETE", uri: "/_/backbeat/expiration/{Bucket}/{Key+}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Retrieves bucket sequence information
@readonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@readonly
@http(method: "GET", uri: "/_/backbeat/index/{Bucket}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@readonly
@http(method: "GET", uri: "/_/metadata/default/attributes/{Bucket}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@http(method: "GET", uri: "/_/backbeat/metadata/{Bucket}/{Key+}")
@readonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@readonly
@http(method: "GET", uri: "/{Bucket}/{Key+}", code: 200)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@readonly
@http(method: "GET", uri: "/_/metadata/default/bucket/{Bucket}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Retrieves buckets associated with a specific Raft log ID
@readonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@readonly
@http(method: "GET", uri: "/_/metadata/admin/buckets/{Bucket}/id")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Retrieves Raft log entries for a specific log ID
@readonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// List lifecycle current objects operation
@readonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// List lifecycle non-current objects operation
@readonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// List lifecycle orphan objects operation
@readonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Aborts a multipart upload for multiple backend storage
@idempotent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Completes a multipart upload for multiple backend storage
@http(method: "POST", uri: "/_/backbeat/multiplebackenddata/{Bucket}/{Key+}?operation=completempu")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@idempotent
@http(method: "DELETE", uri: "/_/backbeat/multiplebackenddata/{Bucket}/{Key+}?operation=deleteobject", code: 200)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Removes tags from an object in multiple backend storage
@idempotent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Retrieves metadata for an object from multiple backend storage
@readonly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Initiates a multipart upload for multiple backend storage
@http(method: "POST", uri: "/_/backbeat/multiplebackenddata/{Bucket}/{Key+}?operation=initiatempu")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

use aws.auth#unsignedPayload

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

use aws.auth#unsignedPayload

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

/// Adds or updates tags for an object in multiple backend storage
@http(method: "POST", uri: "/_/backbeat/multiplebackenddata/{Bucket}/{Key+}?operation=puttagging")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@http(method: "POST", uri: "/_/backbeat/index/{Bucket}?operation=add")
operation PutBucketIndexes {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

@http(method: "PUT", uri: "/_/backbeat/metadata/{Bucket}/{Key+}")
operation PutMetadata {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$version: "2.0"
namespace cloudserver.client
namespace cloudserver.backbeatRoutes

use aws.auth#unsignedPayload

Expand Down
14 changes: 14 additions & 0 deletions models/quotas/deleteBucketQuota.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$version: "2.0"

namespace cloudserver.bucketquota

@http(method: "DELETE", uri: "/{Bucket}?quota=true")
@idempotent
operation DeleteBucketQuota {
input := {
@required
@httpLabel
Bucket: String
}
output := {}
}
17 changes: 17 additions & 0 deletions models/quotas/getBucketQuota.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$version: "2.0"

namespace cloudserver.bucketquota

@http(method: "GET", uri: "/{Bucket}?quota=true")
@readonly
operation GetBucketQuota {
input := {
@required
@httpLabel
Bucket: String
}
output := {
Name: String
Quota: Long
}
}
23 changes: 23 additions & 0 deletions models/quotas/updateBucketQuota.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$version: "2.0"
namespace cloudserver.bucketquota

@http(method: "PUT", uri: "/{Bucket}?quota=true")
@idempotent
operation UpdateBucketQuota {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep same conventions as AWS (and http/rest in general) ?

Suggested change
operation UpdateBucketQuota {
operation PutBucketQuota {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the same names as the ones from the doc, do you confirm you wanna change it ?
Right now :

  • cloudserver : bucketUpdateQuota
  • documentation for clients : UpdateBucketQuota
  • Here : UpdateBucketQuota

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️ let's ask for a vote from the team in the channel?

input: QuotaConfiguration
output: UpdateBucketQuotaOutput
}

structure QuotaConfiguration {
@required
@httpLabel
Bucket: String

@required
Quota: Long
}

structure UpdateBucketQuotaOutput {
@httpPayload
body: String
}
Loading