Skip to content

feat: rust bindings #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ workflows:
name: "Deploy Ruby"
language: ruby
docker_image: cimg/ruby:2.6
- test:
name: "Test Rust"
language: rust
docker_image: cimg/rust:1.85.0
- deploy_bindings:
requires:
- "Test Rust"
filters:
branches:
only:
- master
name: "Deploy Rust"
language: rust
docker_image: cimg/rust:1.85.0
- test:
name: "Test Python 2.7"
language: python
Expand Down
29 changes: 29 additions & 0 deletions bindings/rust/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e

self=$(readlink -f $BASH_SOURCE)
self_dir=$(dirname $self)
root_dir=$(readlink -f "$self_dir/../..")
. $root_dir/scripts/common.sh $1

src_dir="$self_dir/src"
build_json="$src_dir/build.json"
template_dir="$self_dir/templates"

rm -rf $src_dir
mkdir -p $src_dir

cat > $build_json <<EOC
{
"packageName": "$project_underscore",
"packageVersion": "$package_version"
}
EOC

docker container run --rm -v $self_dir:/local "${swagger_codegen_cli_image:?}" generate \
-c /local/src/build.json \
-i $openapi_url \
-l rust \
-o /local/src \
-t /local/templates \
$common_codegen_options
28 changes: 28 additions & 0 deletions bindings/rust/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e

self=$(readlink -f $BASH_SOURCE)
self_dir=$(dirname $self)
root_dir=$(readlink -f "$self_dir/../..")
. $root_dir/scripts/common.sh $1

src_dir="$self_dir/src"

build_distribution() {
echo "Building distribution ..."
cargo package
}

upload_to_crates_io() {
echo "Uploading to crates.io (skipped) ..."
}

upload_to_cloudsmith() {
echo "Uploading to Cloudsmith (skipped)..."
}

set -e
cd $src_dir
build_distribution
upload_to_crates_io
upload_to_cloudsmith
3 changes: 3 additions & 0 deletions bindings/rust/src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target/
**/*.rs.bk
Cargo.lock
23 changes: 23 additions & 0 deletions bindings/rust/src/.swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
1 change: 1 addition & 0 deletions bindings/rust/src/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.4.43
1 change: 1 addition & 0 deletions bindings/rust/src/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: rust
20 changes: 20 additions & 0 deletions bindings/rust/src/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "cloudsmith_api"
version = "2.0.16"
authors = ["Cloudsmith Ltd <[email protected]>"]
license = "Apache-2.0"
homepage = "https://cloudsmith.com/"
repository = "https://github.com/cloudsmith-io/cloudsmith-api"

[dependencies]
serde = "1.0"
serde_derive = "1.0"
serde_yaml = "0.7"
serde_json = "1.0"
base64 = "~0.7.0"
futures = "0.1.16"
hyper = "0.11.6"
url = "1.5"

[dev-dependencies]
tokio-core = "*"
606 changes: 606 additions & 0 deletions bindings/rust/src/README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions bindings/rust/src/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"packageName": "cloudsmith_api",
"packageVersion": "2.0.16"
}
13 changes: 13 additions & 0 deletions bindings/rust/src/docs/AllocatedLimit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# AllocatedLimit

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**configured** | **String** | | [optional] [default to null]
**percentage_used** | **String** | | [optional] [default to null]
**plan_limit** | **String** | | [optional] [default to null]
**used** | **String** | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


13 changes: 13 additions & 0 deletions bindings/rust/src/docs/AllocatedLimitRaw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# AllocatedLimitRaw

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**configured** | **i32** | | [optional] [default to null]
**percentage_used** | **String** | | [optional] [default to null]
**plan_limit** | **i32** | | [optional] [default to null]
**used** | **i32** | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


89 changes: 89 additions & 0 deletions bindings/rust/src/docs/AlpinePackageUpload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# AlpinePackageUpload

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**architectures** | [**Vec<::models::Architecture>**](Architecture.md) | | [optional] [default to null]
**cdn_url** | **String** | | [optional] [default to null]
**checksum_md5** | **String** | | [optional] [default to null]
**checksum_sha1** | **String** | | [optional] [default to null]
**checksum_sha256** | **String** | | [optional] [default to null]
**checksum_sha512** | **String** | | [optional] [default to null]
**dependencies_checksum_md5** | **String** | A checksum of all of the package&#39;s dependencies. | [optional] [default to null]
**dependencies_url** | **String** | | [optional] [default to null]
**description** | **String** | A textual description of this package. | [optional] [default to null]
**display_name** | **String** | | [optional] [default to null]
**distro** | [***::models::Distribution**](Distribution.md) | | [optional] [default to null]
**distro_version** | [***::models::DistributionVersion**](DistributionVersion.md) | | [optional] [default to null]
**downloads** | **i32** | | [optional] [default to null]
**epoch** | **i32** | The epoch of the package version (if any). | [optional] [default to null]
**extension** | **String** | | [optional] [default to null]
**filename** | **String** | | [optional] [default to null]
**files** | [**Vec<::models::PackageFile>**](PackageFile.md) | | [optional] [default to null]
**format** | **String** | | [optional] [default to null]
**format_url** | **String** | | [optional] [default to null]
**freeable_storage** | **i32** | Amount of storage that will be freed if this package is deleted | [optional] [default to null]
**fully_qualified_name** | **String** | | [optional] [default to null]
**identifier_perm** | **String** | Unique and permanent identifier for the package. | [optional] [default to null]
**identifiers** | **::std::collections::HashMap<String, String>** | Return a map of identifier field names and their values. | [optional] [default to null]
**indexed** | **bool** | | [optional] [default to null]
**is_cancellable** | **bool** | | [optional] [default to null]
**is_copyable** | **bool** | | [optional] [default to null]
**is_deleteable** | **bool** | | [optional] [default to null]
**is_downloadable** | **bool** | | [optional] [default to null]
**is_moveable** | **bool** | | [optional] [default to null]
**is_quarantinable** | **bool** | | [optional] [default to null]
**is_quarantined** | **bool** | | [optional] [default to null]
**is_resyncable** | **bool** | | [optional] [default to null]
**is_security_scannable** | **bool** | | [optional] [default to null]
**is_sync_awaiting** | **bool** | | [optional] [default to null]
**is_sync_completed** | **bool** | | [optional] [default to null]
**is_sync_failed** | **bool** | | [optional] [default to null]
**is_sync_in_flight** | **bool** | | [optional] [default to null]
**is_sync_in_progress** | **bool** | | [optional] [default to null]
**license** | **String** | The license of this package. | [optional] [default to null]
**name** | **String** | The name of this package. | [optional] [default to null]
**namespace** | **String** | | [optional] [default to null]
**namespace_url** | **String** | | [optional] [default to null]
**num_files** | **i32** | | [optional] [default to null]
**origin_repository** | **String** | | [optional] [default to null]
**origin_repository_url** | **String** | | [optional] [default to null]
**package_type** | **i32** | The type of package contents. | [optional] [default to null]
**policy_violated** | **bool** | Whether or not the package has violated any policy. | [optional] [default to null]
**release** | **String** | The release of the package version (if any). | [optional] [default to null]
**repository** | **String** | | [optional] [default to null]
**repository_url** | **String** | | [optional] [default to null]
**security_scan_completed_at** | **String** | The datetime the security scanning was completed. | [optional] [default to null]
**security_scan_started_at** | **String** | The datetime the security scanning was started. | [optional] [default to null]
**security_scan_status** | **String** | | [optional] [default to null]
**security_scan_status_updated_at** | **String** | The datetime the security scanning status was updated. | [optional] [default to null]
**self_html_url** | **String** | | [optional] [default to null]
**self_url** | **String** | | [optional] [default to null]
**signature_url** | **String** | | [optional] [default to null]
**size** | **i32** | The calculated size of the package. | [optional] [default to null]
**slug** | **String** | The public unique identifier for the package. | [optional] [default to null]
**slug_perm** | **String** | | [optional] [default to null]
**stage** | **i32** | The synchronisation (in progress) stage of the package. | [optional] [default to null]
**stage_str** | **String** | | [optional] [default to null]
**stage_updated_at** | **String** | The datetime the package stage was updated at. | [optional] [default to null]
**status** | **i32** | The synchronisation status of the package. | [optional] [default to null]
**status_reason** | **String** | A textual description for the synchronous status reason (if any | [optional] [default to null]
**status_str** | **String** | | [optional] [default to null]
**status_updated_at** | **String** | The datetime the package status was updated at. | [optional] [default to null]
**status_url** | **String** | | [optional] [default to null]
**subtype** | **String** | | [optional] [default to null]
**summary** | **String** | A one-liner synopsis of this package. | [optional] [default to null]
**sync_finished_at** | **String** | The datetime the package sync was finished at. | [optional] [default to null]
**sync_progress** | **i32** | Synchronisation progress (from 0-100) | [optional] [default to null]
**tags_immutable** | [***::models::Tags**](Tags.md) | | [optional] [default to null]
**type_display** | **String** | | [optional] [default to null]
**uploaded_at** | **String** | The date this package was uploaded. | [optional] [default to null]
**uploader** | **String** | | [optional] [default to null]
**uploader_url** | **String** | | [optional] [default to null]
**version** | **String** | The raw version for this package. | [optional] [default to null]
**version_orig** | **String** | | [optional] [default to null]
**vulnerability_scan_results_url** | **String** | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


13 changes: 13 additions & 0 deletions bindings/rust/src/docs/AlpinePackageUploadRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# AlpinePackageUploadRequest

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**distribution** | **String** | The distribution to store the package for. | [default to null]
**package_file** | **String** | The primary file for the package. | [default to null]
**republish** | **bool** | If true, the uploaded package will overwrite any others with the same attributes (e.g. same version); otherwise, it will be flagged as a duplicate. | [optional] [default to null]
**tags** | **String** | A comma-separated values list of tags to add to the package. | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


11 changes: 11 additions & 0 deletions bindings/rust/src/docs/Architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Architecture

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**description** | **String** | | [optional] [default to null]
**name** | **String** | | [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


92 changes: 92 additions & 0 deletions bindings/rust/src/docs/AuditLogApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# \AuditLogApi

All URIs are relative to *https://api.cloudsmith.io/v1*

Method | HTTP request | Description
------------- | ------------- | -------------
[**audit_log_namespace_list**](AuditLogApi.md#audit_log_namespace_list) | **Get** /audit-log/{owner}/ | Lists audit log entries for a specific namespace.
[**audit_log_repo_list**](AuditLogApi.md#audit_log_repo_list) | **Get** /audit-log/{owner}/{repo}/ | Lists audit log entries for a specific repository.


# **audit_log_namespace_list**
> Vec<::models::NamespaceAuditLog> audit_log_namespace_list(ctx, ctx, owner, optional)
Lists audit log entries for a specific namespace.

Lists audit log entries for a specific namespace.

### Required Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**owner** | **String**| |
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters

### Optional Parameters
Optional parameters are passed through a map[string]interface{}.

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**owner** | **String**| |
**page** | **i32**| A page number within the paginated result set. |
**page_size** | **i32**| Number of results to return per page. |
**query** | **String**| A search term for querying events, actors, or timestamps of log records. |

### Return type

[**Vec<::models::NamespaceAuditLog>**](NamespaceAuditLog.md)

### Authorization

[apikey](../README.md#apikey), [basic](../README.md#basic)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **audit_log_repo_list**
> Vec<::models::RepositoryAuditLog> audit_log_repo_list(ctx, ctx, owner, repo, optional)
Lists audit log entries for a specific repository.

Lists audit log entries for a specific repository.

### Required Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**owner** | **String**| |
**repo** | **String**| |
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters

### Optional Parameters
Optional parameters are passed through a map[string]interface{}.

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**owner** | **String**| |
**repo** | **String**| |
**page** | **i32**| A page number within the paginated result set. |
**page_size** | **i32**| Number of results to return per page. |
**query** | **String**| A search term for querying events, actors, or timestamps of log records. |

### Return type

[**Vec<::models::RepositoryAuditLog>**](RepositoryAuditLog.md)

### Authorization

[apikey](../README.md#apikey), [basic](../README.md#basic)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

Loading