mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-12 02:15:01 +00:00
types: Add types for SSH Node Resource Constraints (#64287)
This commit is contained in:
@@ -50,6 +50,9 @@ message ResourceConstraints {
|
||||
// aws_console scopes an AWS Console app to a subset of role ARNs
|
||||
// the requester is allowed to use.
|
||||
AWSConsoleResourceConstraints aws_console = 10;
|
||||
// ssh scopes an SSH node to a subset of logins the requester is
|
||||
// allowed to use.
|
||||
SSHResourceConstraints ssh = 11;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +62,12 @@ message AWSConsoleResourceConstraints {
|
||||
repeated string role_arns = 1;
|
||||
}
|
||||
|
||||
// SSHResourceConstraints scopes an SSH node to a subset of logins the
|
||||
// requester is allowed to use.
|
||||
message SSHResourceConstraints {
|
||||
repeated string logins = 1;
|
||||
}
|
||||
|
||||
// ResourceAccessID represents a ResourceID in an Access Request-related context,
|
||||
// where additional information such as ResourceConstraints may be provided.
|
||||
message ResourceAccessID {
|
||||
|
||||
@@ -38,6 +38,10 @@ func (rc *ResourceConstraints) CheckAndSetDefaults() error {
|
||||
if err := d.Validate(); err != nil {
|
||||
return trace.Wrap(err)
|
||||
}
|
||||
case *ResourceConstraints_Ssh:
|
||||
if err := d.Validate(); err != nil {
|
||||
return trace.Wrap(err)
|
||||
}
|
||||
default:
|
||||
return trace.BadParameter("unsupported Details type %T", d)
|
||||
}
|
||||
@@ -74,3 +78,11 @@ func (awsc *ResourceConstraints_AwsConsole) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate ensures Logins is non-nil and contains logins.
|
||||
func (sshc *ResourceConstraints_Ssh) Validate() error {
|
||||
if sshc == nil || sshc.Ssh == nil || len(sshc.Ssh.Logins) == 0 {
|
||||
return trace.BadParameter("ssh constraints require logins, none provided")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+295
-31
@@ -83,6 +83,7 @@ type ResourceConstraints struct {
|
||||
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
|
||||
// Types that are valid to be assigned to Details:
|
||||
// *ResourceConstraints_AwsConsole
|
||||
// *ResourceConstraints_Ssh
|
||||
Details isResourceConstraints_Details `protobuf_oneof:"details"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
@@ -131,8 +132,12 @@ type isResourceConstraints_Details interface {
|
||||
type ResourceConstraints_AwsConsole struct {
|
||||
AwsConsole *AWSConsoleResourceConstraints `protobuf:"bytes,10,opt,name=aws_console,json=awsConsole,proto3,oneof" json:"aws_console,omitempty"`
|
||||
}
|
||||
type ResourceConstraints_Ssh struct {
|
||||
Ssh *SSHResourceConstraints `protobuf:"bytes,11,opt,name=ssh,proto3,oneof" json:"ssh,omitempty"`
|
||||
}
|
||||
|
||||
func (*ResourceConstraints_AwsConsole) isResourceConstraints_Details() {}
|
||||
func (*ResourceConstraints_Ssh) isResourceConstraints_Details() {}
|
||||
|
||||
func (m *ResourceConstraints) GetDetails() isResourceConstraints_Details {
|
||||
if m != nil {
|
||||
@@ -148,10 +153,18 @@ func (m *ResourceConstraints) GetAwsConsole() *AWSConsoleResourceConstraints {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ResourceConstraints) GetSsh() *SSHResourceConstraints {
|
||||
if x, ok := m.GetDetails().(*ResourceConstraints_Ssh); ok {
|
||||
return x.Ssh
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofWrappers is for the internal use of the proto package.
|
||||
func (*ResourceConstraints) XXX_OneofWrappers() []interface{} {
|
||||
return []interface{}{
|
||||
(*ResourceConstraints_AwsConsole)(nil),
|
||||
(*ResourceConstraints_Ssh)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +210,48 @@ func (m *AWSConsoleResourceConstraints) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_AWSConsoleResourceConstraints proto.InternalMessageInfo
|
||||
|
||||
// SSHResourceConstraints scopes an SSH node to a subset of logins the
|
||||
// requester is allowed to use.
|
||||
type SSHResourceConstraints struct {
|
||||
Logins []string `protobuf:"bytes,1,rep,name=logins,proto3" json:"logins,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SSHResourceConstraints) Reset() { *m = SSHResourceConstraints{} }
|
||||
func (m *SSHResourceConstraints) String() string { return proto.CompactTextString(m) }
|
||||
func (*SSHResourceConstraints) ProtoMessage() {}
|
||||
func (*SSHResourceConstraints) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_463abd6003cf656a, []int{3}
|
||||
}
|
||||
func (m *SSHResourceConstraints) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *SSHResourceConstraints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_SSHResourceConstraints.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *SSHResourceConstraints) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SSHResourceConstraints.Merge(m, src)
|
||||
}
|
||||
func (m *SSHResourceConstraints) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *SSHResourceConstraints) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SSHResourceConstraints.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SSHResourceConstraints proto.InternalMessageInfo
|
||||
|
||||
// ResourceAccessID represents a ResourceID in an Access Request-related context,
|
||||
// where additional information such as ResourceConstraints may be provided.
|
||||
type ResourceAccessID struct {
|
||||
@@ -211,7 +266,7 @@ func (m *ResourceAccessID) Reset() { *m = ResourceAccessID{} }
|
||||
func (m *ResourceAccessID) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResourceAccessID) ProtoMessage() {}
|
||||
func (*ResourceAccessID) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_463abd6003cf656a, []int{3}
|
||||
return fileDescriptor_463abd6003cf656a, []int{4}
|
||||
}
|
||||
func (m *ResourceAccessID) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -252,7 +307,7 @@ func (m *ResourceAccessIDList) Reset() { *m = ResourceAccessIDList{} }
|
||||
func (m *ResourceAccessIDList) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResourceAccessIDList) ProtoMessage() {}
|
||||
func (*ResourceAccessIDList) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_463abd6003cf656a, []int{4}
|
||||
return fileDescriptor_463abd6003cf656a, []int{5}
|
||||
}
|
||||
func (m *ResourceAccessIDList) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -285,6 +340,7 @@ func init() {
|
||||
proto.RegisterType((*ResourceID)(nil), "types.ResourceID")
|
||||
proto.RegisterType((*ResourceConstraints)(nil), "types.ResourceConstraints")
|
||||
proto.RegisterType((*AWSConsoleResourceConstraints)(nil), "types.AWSConsoleResourceConstraints")
|
||||
proto.RegisterType((*SSHResourceConstraints)(nil), "types.SSHResourceConstraints")
|
||||
proto.RegisterType((*ResourceAccessID)(nil), "types.ResourceAccessID")
|
||||
proto.RegisterType((*ResourceAccessIDList)(nil), "types.ResourceAccessIDList")
|
||||
}
|
||||
@@ -294,35 +350,38 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_463abd6003cf656a = []byte{
|
||||
// 447 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x4d, 0x8f, 0xd2, 0x40,
|
||||
0x18, 0x66, 0x58, 0x94, 0xed, 0xdb, 0x83, 0x3a, 0x6e, 0xb4, 0x41, 0x05, 0xd2, 0x68, 0x24, 0x51,
|
||||
0x69, 0x82, 0x47, 0xf5, 0x40, 0x21, 0xd1, 0x8d, 0xc6, 0xc3, 0x70, 0x30, 0xf1, 0x42, 0x86, 0x76,
|
||||
0x52, 0x27, 0xb6, 0x33, 0xcd, 0xcc, 0x74, 0x37, 0x9c, 0x3c, 0xf8, 0xbb, 0xbc, 0x73, 0xf4, 0x17,
|
||||
0x10, 0xe5, 0xc8, 0xaf, 0x30, 0x4c, 0x29, 0x90, 0xc6, 0xec, 0xad, 0x7d, 0x3e, 0xde, 0x79, 0x66,
|
||||
0xde, 0x07, 0x9e, 0x19, 0x96, 0xb2, 0x5c, 0x2a, 0x13, 0xa4, 0x2c, 0xa1, 0xd1, 0x32, 0x30, 0xcb,
|
||||
0x9c, 0xe9, 0x40, 0x31, 0x2d, 0x0b, 0x15, 0x31, 0x3d, 0xcc, 0x95, 0x34, 0x12, 0xdf, 0xb2, 0x70,
|
||||
0xe7, 0x22, 0x91, 0x89, 0xb4, 0x48, 0xb0, 0xfb, 0x2a, 0x49, 0xff, 0x17, 0x02, 0x20, 0x7b, 0xc3,
|
||||
0xe5, 0x14, 0xbf, 0x02, 0x77, 0x92, 0x16, 0xda, 0x30, 0xf5, 0x99, 0x66, 0xcc, 0x43, 0x7d, 0x34,
|
||||
0x70, 0x42, 0x77, 0xbb, 0xee, 0xb5, 0xa3, 0x12, 0x26, 0xa7, 0x3c, 0x7e, 0x0c, 0xad, 0x8f, 0x5c,
|
||||
0xc4, 0x5e, 0xd3, 0xea, 0xce, 0xb7, 0xeb, 0x5e, 0xeb, 0x3b, 0x17, 0x31, 0xb1, 0xe8, 0x8e, 0xb5,
|
||||
0x53, 0xce, 0x8e, 0xac, 0xa0, 0x19, 0x23, 0x16, 0xc5, 0x53, 0xb8, 0x33, 0x2b, 0x16, 0xd5, 0xd9,
|
||||
0x56, 0xd8, 0xb2, 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0x37, 0xe0, 0x1c, 0xca, 0x64, 0x53, 0xbb, 0xa3, 0x87, 0xb5, 0xc9, 0x95, 0x7e, 0x9f, 0xe8,
|
||||
0xa8, 0x0f, 0xdf, 0xad, 0xfe, 0x76, 0x1b, 0xab, 0x4d, 0x17, 0xfd, 0xde, 0x74, 0xd1, 0x9f, 0x4d,
|
||||
0x17, 0x7d, 0x7d, 0x91, 0x70, 0xf3, 0xad, 0x58, 0x0c, 0x23, 0x99, 0x05, 0x89, 0xa2, 0x57, 0xdc,
|
||||
0x50, 0xc3, 0xa5, 0xa0, 0x69, 0x70, 0x28, 0x32, 0xcd, 0x79, 0xd9, 0xe2, 0xc5, 0x6d, 0xdb, 0xcf,
|
||||
0xd7, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x73, 0x57, 0xc6, 0xe1, 0xe5, 0x02, 0x00, 0x00,
|
||||
// 483 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xcf, 0x8f, 0xd2, 0x4e,
|
||||
0x14, 0x67, 0x80, 0xef, 0xb2, 0xbc, 0x1e, 0xbe, 0x3a, 0x6e, 0xb0, 0x41, 0x17, 0x48, 0xa3, 0x91,
|
||||
0x44, 0xa5, 0x8a, 0x47, 0xf5, 0xc0, 0x8f, 0xc4, 0xdd, 0x68, 0x3c, 0x0c, 0x07, 0x13, 0x2f, 0x64,
|
||||
0x28, 0x93, 0xee, 0xc4, 0x76, 0xa6, 0x99, 0x99, 0xee, 0x86, 0x93, 0xff, 0x95, 0x37, 0xef, 0x1c,
|
||||
0xfd, 0x0b, 0x88, 0x72, 0xe4, 0xaf, 0x30, 0x4c, 0x5b, 0x20, 0x84, 0x78, 0xeb, 0x7c, 0x7e, 0xbd,
|
||||
0xf7, 0xa6, 0xf3, 0xe0, 0xa9, 0x61, 0x11, 0x4b, 0xa4, 0x32, 0x7e, 0xc4, 0x42, 0x1a, 0x2c, 0x7c,
|
||||
0xb3, 0x48, 0x98, 0xf6, 0x15, 0xd3, 0x32, 0x55, 0x01, 0xd3, 0xbd, 0x44, 0x49, 0x23, 0xf1, 0x7f,
|
||||
0x16, 0x6e, 0x5e, 0x84, 0x32, 0x94, 0x16, 0xf1, 0xb7, 0x5f, 0x19, 0xe9, 0xfd, 0x44, 0x00, 0x24,
|
||||
0x37, 0x5c, 0x8f, 0xf1, 0x4b, 0x70, 0x46, 0x51, 0xaa, 0x0d, 0x53, 0x9f, 0x69, 0xcc, 0x5c, 0xd4,
|
||||
0x41, 0xdd, 0xfa, 0xd0, 0xd9, 0xac, 0xda, 0xb5, 0x20, 0x83, 0xc9, 0x21, 0x8f, 0x1f, 0x43, 0xf5,
|
||||
0x23, 0x17, 0x73, 0xb7, 0x6c, 0x75, 0xe7, 0x9b, 0x55, 0xbb, 0xfa, 0x8d, 0x8b, 0x39, 0xb1, 0xe8,
|
||||
0x96, 0xb5, 0x29, 0x95, 0x3d, 0x2b, 0x68, 0xcc, 0x88, 0x45, 0xf1, 0x18, 0xfe, 0x9f, 0xa4, 0xb3,
|
||||
0xa2, 0xb6, 0x15, 0x56, 0xad, 0xb0, 0xb9, 0x59, 0xb5, 0x1b, 0x3a, 0x9d, 0x4d, 0x8b, 0x41, 0x5e,
|
||||
0xc8, 0x98, 0x1b, 0x16, 0x27, 0x66, 0x41, 0x8e, 0x2d, 0xde, 0x0f, 0x04, 0x0f, 0x0a, 0x60, 0x24,
|
||||
0x85, 0x36, 0x8a, 0x72, 0x61, 0x34, 0x76, 0xa1, 0x76, 0xcb, 0x94, 0xe6, 0x52, 0x64, 0x43, 0x90,
|
||||
0xe2, 0x88, 0x3f, 0x80, 0x43, 0xef, 0xf4, 0x34, 0x90, 0x42, 0xcb, 0x88, 0xb9, 0xd0, 0x41, 0x5d,
|
||||
0xa7, 0xff, 0xa4, 0x67, 0x2f, 0xa9, 0x37, 0xf8, 0x32, 0x19, 0x65, 0xc4, 0x89, 0xd0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d, 0xf5, 0x02, 0x19, 0xfb,
|
||||
0xa1, 0xa2, 0xb7, 0xdc, 0x50, 0xc3, 0xa5, 0xa0, 0x91, 0xbf, 0xdb, 0x16, 0x9a, 0xf0, 0x6c, 0x55,
|
||||
0x66, 0x67, 0x76, 0x09, 0xde, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xe0, 0x19, 0x15, 0x4a,
|
||||
0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *ResourceID) Marshal() (dAtA []byte, err error) {
|
||||
@@ -444,6 +503,27 @@ func (m *ResourceConstraints_AwsConsole) MarshalToSizedBuffer(dAtA []byte) (int,
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
func (m *ResourceConstraints_Ssh) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ResourceConstraints_Ssh) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
if m.Ssh != nil {
|
||||
{
|
||||
size, err := m.Ssh.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintResources(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x5a
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
func (m *AWSConsoleResourceConstraints) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@@ -480,6 +560,42 @@ func (m *AWSConsoleResourceConstraints) MarshalToSizedBuffer(dAtA []byte) (int,
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *SSHResourceConstraints) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *SSHResourceConstraints) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *SSHResourceConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
if len(m.Logins) > 0 {
|
||||
for iNdEx := len(m.Logins) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(m.Logins[iNdEx])
|
||||
copy(dAtA[i:], m.Logins[iNdEx])
|
||||
i = encodeVarintResources(dAtA, i, uint64(len(m.Logins[iNdEx])))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ResourceAccessID) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@@ -640,6 +756,18 @@ func (m *ResourceConstraints_AwsConsole) Size() (n int) {
|
||||
}
|
||||
return n
|
||||
}
|
||||
func (m *ResourceConstraints_Ssh) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Ssh != nil {
|
||||
l = m.Ssh.Size()
|
||||
n += 1 + l + sovResources(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
func (m *AWSConsoleResourceConstraints) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@@ -658,6 +786,24 @@ func (m *AWSConsoleResourceConstraints) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *SSHResourceConstraints) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Logins) > 0 {
|
||||
for _, s := range m.Logins {
|
||||
l = len(s)
|
||||
n += 1 + l + sovResources(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ResourceAccessID) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@@ -975,6 +1121,41 @@ func (m *ResourceConstraints) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.Details = &ResourceConstraints_AwsConsole{v}
|
||||
iNdEx = postIndex
|
||||
case 11:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Ssh", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowResources
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthResources
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthResources
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v := &SSHResourceConstraints{}
|
||||
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
m.Details = &ResourceConstraints_Ssh{v}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipResources(dAtA[iNdEx:])
|
||||
@@ -1080,6 +1261,89 @@ func (m *AWSConsoleResourceConstraints) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *SSHResourceConstraints) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowResources
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: SSHResourceConstraints: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: SSHResourceConstraints: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Logins", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowResources
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthResources
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthResources
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Logins = append(m.Logins, string(dAtA[iNdEx:postIndex]))
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipResources(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthResources
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ResourceAccessID) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
+79
-1
@@ -88,6 +88,15 @@ export interface ResourceConstraints {
|
||||
* @generated from protobuf field: types.AWSConsoleResourceConstraints aws_console = 10;
|
||||
*/
|
||||
awsConsole: AWSConsoleResourceConstraints;
|
||||
} | {
|
||||
oneofKind: "ssh";
|
||||
/**
|
||||
* ssh scopes an SSH node to a subset of logins the requester is
|
||||
* allowed to use.
|
||||
*
|
||||
* @generated from protobuf field: types.SSHResourceConstraints ssh = 11;
|
||||
*/
|
||||
ssh: SSHResourceConstraints;
|
||||
} | {
|
||||
oneofKind: undefined;
|
||||
};
|
||||
@@ -104,6 +113,18 @@ export interface AWSConsoleResourceConstraints {
|
||||
*/
|
||||
roleArns: string[];
|
||||
}
|
||||
/**
|
||||
* SSHResourceConstraints scopes an SSH node to a subset of logins the
|
||||
* requester is allowed to use.
|
||||
*
|
||||
* @generated from protobuf message types.SSHResourceConstraints
|
||||
*/
|
||||
export interface SSHResourceConstraints {
|
||||
/**
|
||||
* @generated from protobuf field: repeated string logins = 1;
|
||||
*/
|
||||
logins: string[];
|
||||
}
|
||||
/**
|
||||
* ResourceAccessID represents a ResourceID in an Access Request-related context,
|
||||
* where additional information such as ResourceConstraints may be provided.
|
||||
@@ -207,7 +228,8 @@ class ResourceConstraints$Type extends MessageType<ResourceConstraints> {
|
||||
constructor() {
|
||||
super("types.ResourceConstraints", [
|
||||
{ no: 1, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 10, name: "aws_console", kind: "message", oneof: "details", T: () => AWSConsoleResourceConstraints }
|
||||
{ no: 10, name: "aws_console", kind: "message", oneof: "details", T: () => AWSConsoleResourceConstraints },
|
||||
{ no: 11, name: "ssh", kind: "message", oneof: "details", T: () => SSHResourceConstraints }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<ResourceConstraints>): ResourceConstraints {
|
||||
@@ -232,6 +254,12 @@ class ResourceConstraints$Type extends MessageType<ResourceConstraints> {
|
||||
awsConsole: AWSConsoleResourceConstraints.internalBinaryRead(reader, reader.uint32(), options, (message.details as any).awsConsole)
|
||||
};
|
||||
break;
|
||||
case /* types.SSHResourceConstraints ssh */ 11:
|
||||
message.details = {
|
||||
oneofKind: "ssh",
|
||||
ssh: SSHResourceConstraints.internalBinaryRead(reader, reader.uint32(), options, (message.details as any).ssh)
|
||||
};
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
@@ -250,6 +278,9 @@ class ResourceConstraints$Type extends MessageType<ResourceConstraints> {
|
||||
/* types.AWSConsoleResourceConstraints aws_console = 10; */
|
||||
if (message.details.oneofKind === "awsConsole")
|
||||
AWSConsoleResourceConstraints.internalBinaryWrite(message.details.awsConsole, writer.tag(10, WireType.LengthDelimited).fork(), options).join();
|
||||
/* types.SSHResourceConstraints ssh = 11; */
|
||||
if (message.details.oneofKind === "ssh")
|
||||
SSHResourceConstraints.internalBinaryWrite(message.details.ssh, writer.tag(11, WireType.LengthDelimited).fork(), options).join();
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
@@ -308,6 +339,53 @@ class AWSConsoleResourceConstraints$Type extends MessageType<AWSConsoleResourceC
|
||||
*/
|
||||
export const AWSConsoleResourceConstraints = new AWSConsoleResourceConstraints$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class SSHResourceConstraints$Type extends MessageType<SSHResourceConstraints> {
|
||||
constructor() {
|
||||
super("types.SSHResourceConstraints", [
|
||||
{ no: 1, name: "logins", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<SSHResourceConstraints>): SSHResourceConstraints {
|
||||
const message = globalThis.Object.create((this.messagePrototype!));
|
||||
message.logins = [];
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<SSHResourceConstraints>(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SSHResourceConstraints): SSHResourceConstraints {
|
||||
let message = target ?? this.create(), end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* repeated string logins */ 1:
|
||||
message.logins.push(reader.string());
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message: SSHResourceConstraints, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* repeated string logins = 1; */
|
||||
for (let i = 0; i < message.logins.length; i++)
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.logins[i]);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message types.SSHResourceConstraints
|
||||
*/
|
||||
export const SSHResourceConstraints = new SSHResourceConstraints$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class ResourceAccessID$Type extends MessageType<ResourceAccessID> {
|
||||
constructor() {
|
||||
super("types.ResourceAccessID", [
|
||||
|
||||
Reference in New Issue
Block a user