merged commit for plugin rework, storage bucket sql and proto, storage bucket secret rewrapping, storage bucket repository

This commit is contained in:
Danielle Miu authored and Timothy Messier committed 2023-05-31 12:18:13 +00:00
1 parent 38723f8112
commit a4a14fc7fc
66 files changed
+2332 -980

No files matched your search

@@ -1,47 +0,0 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
// Package store provides protobufs for storing types in the host package.
package controller.storage.plugin.host.store.v1;
import "controller/custom_options/v1/options.proto";
import "controller/storage/timestamp/v1/timestamp.proto";
option go_package = "github.com/hashicorp/boundary/internal/plugin/host/store;store";
message Plugin {
// public_id is a surrogate key suitable for use in a public API.
// @inject_tag: `gorm:"primary_key"`
string public_id = 10;
// The create_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp create_time = 20;
// The update_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp update_time = 30;
// name is optional. If set, it must be unique within scope_id.
// @inject_tag: `gorm:"default:null"`
string name = 4 [(custom_options.v1.mask_mapping) = {
this: "Name"
that: "name"
}];
// description is optional.
// @inject_tag: `gorm:"default:null"`
string description = 50 [(custom_options.v1.mask_mapping) = {
this: "Description"
that: "description"
}];
// The scope_id of the owning scope and must be set.
// @inject_tag: `gorm:"not_null"`
string scope_id = 60;
// @inject_tag: `gorm:"default:null"`
uint32 version = 70;
}
@@ -6,10 +6,11 @@ syntax = "proto3";
// Package store provides protobufs for storing types in the host package.
package controller.storage.plugin.store.v1;
import "controller/custom_options/v1/options.proto";
import "controller/storage/timestamp/v1/timestamp.proto";
option go_package = "github.com/hashicorp/boundary/internal/plugin/store;store";
// This is a typeless plugin. In practice this should never be used directly.
// This is included for testing purposes only.
message Plugin {
// public_id is a surrogate key suitable for use in a public API.
// @inject_tag: `gorm:"primary_key"`
@@ -21,5 +22,26 @@ message Plugin {
// name is optional. If set, it must be unique within scope_id.
// @inject_tag: `gorm:"default:null"`
string name = 30;
string name = 30 [(custom_options.v1.mask_mapping) = {
this: "Name"
that: "name"
}];
// description is optional.
// @inject_tag: `gorm:"default:null"`
string description = 40 [(custom_options.v1.mask_mapping) = {
this: "Description"
that: "description"
}];
// The create_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp create_time = 50;
// The update_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp update_time = 60;
// @inject_tag: `gorm:"default:null"`
uint32 version = 70;
}
@@ -0,0 +1,91 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
// Package store provides protobufs for storing types in the storage plugin
// package.
package controller.storage.storage.plugin.store.v1;
import "controller/custom_options/v1/options.proto";
import "controller/storage/timestamp/v1/timestamp.proto";
option go_package = "github.com/hashicorp/boundary/internal/storage/plugin/store;store";
message StorageBucket {
// public_id is a surrogate key suitable for use in a public API.
// @inject_tag: `gorm:"primary_key"`
string public_id = 1;
// The scope_id of the owning scope and must be set.
// @inject_tag: `gorm:"not_null"`
string scope_id = 2;
// name is optional. If set, it must be globally unique.
// @inject_tag: `gorm:"default:null"`
string name = 3 [(custom_options.v1.mask_mapping) = {
this: "Name"
that: "name"
}];
// description is optional.
// @inject_tag: `gorm:"default:null"`
string description = 4 [(custom_options.v1.mask_mapping) = {
this: "Description"
that: "description"
}];
// The create_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp create_time = 5;
// The update_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp update_time = 6;
// @inject_tag: `gorm:"default:null"`
uint32 version = 7;
// The plugin_id is the public id of the plugin managing this storage bucket.
// @inject_tag: `gorm:"not_null"`
string plugin_id = 8;
// The name of the external storage bucket (as opposed to the name within boundary)
// @inject_tag: `gorm:"not_null"`
string bucket_name = 9;
// @inject_tag: `gorm:"default:null"`
string bucket_prefix = 10;
// A boolean expression that allows filtering the workers that can handle a storage buckets
// @inject_tag: `gorm:"not_null"`
string worker_filter = 11;
// attributes is a json formatted field.
// @inject_tag: `gorm:"not_null"`
bytes attributes = 12;
// secrets_hmac is a sha256-hmac of the unencrypted secrets stored in the db.
// @inject_tag: `gorm:"not_null"`
bytes secrets_hmac = 13;
}
message StorageBucketSecret {
// storage_bucket_id is the public id of the storage bucket using this secret.
// @inject_tag: `gorm:"primary_key"`
string storage_bucket_id = 1;
// secrets is the plain-text of the secret data. We are not storing this plain-text
// value in the database.
// @inject_tag: `gorm:"-" wrapping:"pt,secrets_data"`
bytes secrets = 2;
// ct_secrets is the ciphertext of the secret data stored in the db.
// @inject_tag: `gorm:"column:secrets_encrypted;not_null" wrapping:"ct,secrets_data"`
bytes ct_secrets = 3;
// The key_id of the kms database key used for encrypting this entry.
// It must be set.
// @inject_tag: `gorm:"not_null"`
string key_id = 4;
}