Allow logical backends access to the disabled state of an entity (#6791)

* Allow logical backends access to the disabled state of an entity via SystemView.EntityInfo().

* Add generated file in vendor directory.
This commit is contained in:
tonyd
2019-05-28 17:31:50 -04:00
committed by Jeff Mitchell
parent 4c5972cb8d
commit ed57002711
5 changed files with 67 additions and 42 deletions

View File

@@ -32,6 +32,8 @@ type Entity struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
// Disabled is true if the entity is disabled.
Disabled bool `sentinel:"" protobuf:"varint,5,opt,name=disabled,proto3" json:"disabled,omitempty"`
}
func (m *Entity) Reset() { *m = Entity{} }
@@ -87,6 +89,13 @@ func (m *Entity) GetMetadata() map[string]string {
return nil
}
func (m *Entity) GetDisabled() bool {
if m != nil {
return m.Disabled
}
return false
}
type Alias struct {
// MountType is the backend mount's type to which this identity belongs
MountType string `sentinel:"" protobuf:"bytes,1,opt,name=mount_type,json=mountType,proto3" json:"mount_type,omitempty"`
@@ -165,24 +174,25 @@ func init() {
func init() { proto.RegisterFile("sdk/logical/identity.proto", fileDescriptor_4a34d35719c603a1) }
var fileDescriptor_4a34d35719c603a1 = []byte{
// 291 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0x4f, 0x6b, 0x83, 0x40,
0x10, 0xc5, 0x51, 0xf3, 0xa7, 0x99, 0x12, 0x29, 0x4b, 0x0f, 0x12, 0x1a, 0x08, 0x81, 0x16, 0x4f,
0x0a, 0xed, 0x25, 0x6d, 0x4f, 0x29, 0xc9, 0x21, 0x87, 0x5e, 0xa4, 0xa7, 0x5e, 0xca, 0x44, 0x97,
0xb8, 0x44, 0x5d, 0x71, 0xc7, 0x80, 0x5f, 0xb2, 0xe7, 0x7e, 0x9c, 0x92, 0x75, 0x23, 0x09, 0x3d,
0xf7, 0x36, 0xfe, 0xde, 0x38, 0xfb, 0xe6, 0x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c, 0xf3, 0x30, 0x45, 0x95, 0x8a, 0x58, 0x56, 0x65, 0x78, 0xc0, 0x3a, 0xa3, 0xf0, 0xec, 0xda,
0xdb, 0x81, 0xbe, 0xf2, 0xd3, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x36, 0xa9, 0x44, 0x63, 0x03,
0x02, 0x00, 0x00,
// 310 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0xbf, 0x6a, 0xc3, 0x30,
0x10, 0xc6, 0x91, 0x9d, 0xbf, 0x57, 0x12, 0x8a, 0xe8, 0x60, 0x42, 0x03, 0x21, 0xd0, 0xe2, 0xc9,
0x86, 0x76, 0x49, 0xdb, 0x29, 0x25, 0x19, 0x32, 0x74, 0x31, 0x9d, 0xba, 0x94, 0x8b, 0x2d, 0x62,
0x11, 0xd9, 0x32, 0x96, 0x1c, 0xf0, 0x9b, 0xf6, 0x19, 0xfa, 0x14, 0x25, 0xb2, 0x62, 0x12, 0x4a,
0xa7, 0x6e, 0xba, 0xdf, 0x77, 0x77, 0xba, 0xfb, 0x38, 0x98, 0xa8, 0x64, 0x1f, 0x0a, 0xb9, 0xe3,
0x31, 0x8a, 0x90, 0x27, 0x2c, 0xd7, 0x5c, 0xd7, 0x41, 0x51, 0x4a, 0x2d, 0x69, 0xdf, 0xf2, 0xf9,
0x37, 0x81, 0xde, 0xda, 0x28, 0x74, 0x0c, 0xce, 0x66, 0xe5, 0x91, 0x19, 0xf1, 0x87, 0x91, 0xb3,
0x59, 0x51, 0x0a, 0x9d, 0x1c, 0x33, 0xe6, 0x39, 0x86, 0x98, 0x37, 0xf5, 0xa1, 0x8f, 0x82, 0xa3,
0x62, 0xca, 0x73, 0x67, 0xae, 0x7f, 0xf5, 0x30, 0x0e, 0x6c, 0xa7, 0x60, 0x79, 0xe4, 0xd1, 0x49,
0xa6, 0x4f, 0x30, 0xc8, 0x98, 0xc6, 0x04, 0x35, 0x7a, 0x1d, 0x93, 0x3a, 0x6d, 0x53, 0x9b, 0x0f,
0x83, 0x37, 0xab, 0xaf, 0x73, 0x5d, 0xd6, 0x51, 0x9b, 0x4e, 0x27, 0x30, 0x48, 0xb8, 0xc2, 0xad,
0x60, 0x89, 0xd7, 0x9d, 0x11, 0x7f, 0x10, 0xb5, 0xf1, 0xe4, 0x05, 0x46, 0x17, 0x65, 0xf4, 0x1a,
0xdc, 0x3d, 0xab, 0xed, 0xd8, 0xc7, 0x27, 0xbd, 0x81, 0xee, 0x01, 0x45, 0x75, 0x1a, 0xbc, 0x09,
0x9e, 0x9d, 0x05, 0x99, 0x7f, 0x11, 0xe8, 0x9a, 0x31, 0xe9, 0x14, 0x20, 0x93, 0x55, 0xae, 0x3f,
0x75, 0x5d, 0x30, 0x5b, 0x3c, 0x34, 0xe4, 0xbd, 0x2e, 0x18, 0xbd, 0x83, 0x71, 0x23, 0x63, 0x1c,
0x33, 0xa5, 0x64, 0x69, 0x7b, 0x8d, 0x0c, 0x5d, 0x5a, 0xd8, 0x3a, 0xe4, 0x9e, 0x39, 0xb4, 0xf8,
0xb5, 0xf7, 0xed, 0xa5, 0x45, 0x7f, 0xad, 0xfd, 0xaf, 0xd5, 0x5e, 0xfd, 0x8f, 0xfb, 0x1d, 0xd7,
0x69, 0xb5, 0x0d, 0x62, 0x99, 0x85, 0x29, 0xaa, 0x94, 0xc7, 0xb2, 0x2c, 0xc2, 0x03, 0x56, 0x42,
0x87, 0x67, 0x97, 0xb0, 0xed, 0x99, 0x0b, 0x78, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0xfa, 0xa9,
0x8a, 0x39, 0x1f, 0x02, 0x00, 0x00,
}

View File

@@ -16,6 +16,9 @@ message Entity {
// Metadata represents the custom data tied to this entity
map<string, string> metadata = 4;
// Disabled is true if the entity is disabled.
bool disabled = 5;
}
message Alias {

View File

@@ -184,6 +184,7 @@ func TestSystem_GRPC_entityInfo(t *testing.T) {
},
},
},
Disabled: true,
}
client, _ := plugin.TestGRPCConn(t, func(s *grpc.Server) {
pb.RegisterSystemViewServer(s, &gRPCSystemViewServer{

View File

@@ -224,8 +224,9 @@ func (d dynamicSystemView) EntityInfo(entityID string) (*logical.Entity, error)
// Return a subset of the data
ret := &logical.Entity{
ID: entity.ID,
Name: entity.Name,
ID: entity.ID,
Name: entity.Name,
Disabled: entity.Disabled,
}
if entity.Metadata != nil {

View File

@@ -32,6 +32,8 @@ type Entity struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
// Disabled is true if the entity is disabled.
Disabled bool `sentinel:"" protobuf:"varint,5,opt,name=disabled,proto3" json:"disabled,omitempty"`
}
func (m *Entity) Reset() { *m = Entity{} }
@@ -87,6 +89,13 @@ func (m *Entity) GetMetadata() map[string]string {
return nil
}
func (m *Entity) GetDisabled() bool {
if m != nil {
return m.Disabled
}
return false
}
type Alias struct {
// MountType is the backend mount's type to which this identity belongs
MountType string `sentinel:"" protobuf:"bytes,1,opt,name=mount_type,json=mountType,proto3" json:"mount_type,omitempty"`
@@ -165,24 +174,25 @@ func init() {
func init() { proto.RegisterFile("sdk/logical/identity.proto", fileDescriptor_4a34d35719c603a1) }
var fileDescriptor_4a34d35719c603a1 = []byte{
// 291 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0x4f, 0x6b, 0x83, 0x40,
0x10, 0xc5, 0x51, 0xf3, 0xa7, 0x99, 0x12, 0x29, 0x4b, 0x0f, 0x12, 0x1a, 0x08, 0x81, 0x16, 0x4f,
0x0a, 0xed, 0x25, 0x6d, 0x4f, 0x29, 0xc9, 0x21, 0x87, 0x5e, 0xa4, 0xa7, 0x5e, 0xca, 0x44, 0x97,
0xb8, 0x44, 0x5d, 0x71, 0xc7, 0x80, 0x5f, 0xb2, 0xe7, 0x7e, 0x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x18, 0xfe, 0x65, 0xb5, 0x37, 0xff, 0xf3, 0x61, 0x27, 0x28, 0xad, 0xb7, 0x41,
0x2c, 0xf3, 0x30, 0x45, 0x95, 0x8a, 0x58, 0x56, 0x65, 0x78, 0xc0, 0x3a, 0xa3, 0xf0, 0xec, 0xda,
0xdb, 0x81, 0xbe, 0xf2, 0xd3, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x36, 0xa9, 0x44, 0x63, 0x03,
0x02, 0x00, 0x00,
// 310 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0xbf, 0x6a, 0xc3, 0x30,
0x10, 0xc6, 0x91, 0x9d, 0xbf, 0x57, 0x12, 0x8a, 0xe8, 0x60, 0x42, 0x03, 0x21, 0xd0, 0xe2, 0xc9,
0x86, 0x76, 0x49, 0xdb, 0x29, 0x25, 0x19, 0x32, 0x74, 0x31, 0x9d, 0xba, 0x94, 0x8b, 0x2d, 0x62,
0x11, 0xd9, 0x32, 0x96, 0x1c, 0xf0, 0x9b, 0xf6, 0x19, 0xfa, 0x14, 0x25, 0xb2, 0x62, 0x12, 0x4a,
0xa7, 0x6e, 0xba, 0xdf, 0x77, 0x77, 0xba, 0xfb, 0x38, 0x98, 0xa8, 0x64, 0x1f, 0x0a, 0xb9, 0xe3,
0x31, 0x8a, 0x90, 0x27, 0x2c, 0xd7, 0x5c, 0xd7, 0x41, 0x51, 0x4a, 0x2d, 0x69, 0xdf, 0xf2, 0xf9,
0x37, 0x81, 0xde, 0xda, 0x28, 0x74, 0x0c, 0xce, 0x66, 0xe5, 0x91, 0x19, 0xf1, 0x87, 0x91, 0xb3,
0x59, 0x51, 0x0a, 0x9d, 0x1c, 0x33, 0xe6, 0x39, 0x86, 0x98, 0x37, 0xf5, 0xa1, 0x8f, 0x82, 0xa3,
0x62, 0xca, 0x73, 0x67, 0xae, 0x7f, 0xf5, 0x30, 0x0e, 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