Add Auth Account id to Auth Token response (#363)

pull/364/head
Todd Knight 6 years ago committed by GitHub
parent 2b664f78ed
commit f96fa25157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,6 +19,7 @@ type AuthToken struct {
Token string `json:"token,omitempty"`
UserId string `json:"user_id,omitempty"`
AuthMethodId string `json:"auth_method_id,omitempty"`
AccountId string `json:"account_id,omitempty"`
CreatedTime time.Time `json:"created_time,omitempty"`
UpdatedTime time.Time `json:"updated_time,omitempty"`
ApproximateLastUsedTime time.Time `json:"approximate_last_used_time,omitempty"`

@ -2355,7 +2355,12 @@
},
"auth_method_id": {
"type": "string",
"description": "The id of the user of this AuthToken.\nOutput only.",
"description": "The id of the auth method of this AuthToken.\nOutput only.",
"readOnly": true
},
"account_id": {
"type": "string",
"description": "The id of the auth method account of this AuthToken.\nOutput only.",
"readOnly": true
},
"created_time": {

@ -50,21 +50,24 @@ type AuthToken struct {
// The id of the user of this AuthToken.
// Output only.
UserId string `protobuf:"bytes,50,opt,name=user_id,proto3" json:"user_id,omitempty"`
// The id of the user of this AuthToken.
// The id of the auth method of this AuthToken.
// Output only.
AuthMethodId string `protobuf:"bytes,60,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"`
// The id of the auth method account of this AuthToken.
// Output only.
AccountId string `protobuf:"bytes,70,opt,name=account_id,proto3" json:"account_id,omitempty"`
// The time this resource was created
// Output only.
CreatedTime *timestamp.Timestamp `protobuf:"bytes,70,opt,name=created_time,proto3" json:"created_time,omitempty"`
CreatedTime *timestamp.Timestamp `protobuf:"bytes,80,opt,name=created_time,proto3" json:"created_time,omitempty"`
// The time this resource was last updated.
// Output only.
UpdatedTime *timestamp.Timestamp `protobuf:"bytes,80,opt,name=updated_time,proto3" json:"updated_time,omitempty"`
UpdatedTime *timestamp.Timestamp `protobuf:"bytes,90,opt,name=updated_time,proto3" json:"updated_time,omitempty"`
// The approximate time this AuthToken was last used.
// Output only.
ApproximateLastUsedTime *timestamp.Timestamp `protobuf:"bytes,90,opt,name=approximate_last_used_time,proto3" json:"approximate_last_used_time,omitempty"`
ApproximateLastUsedTime *timestamp.Timestamp `protobuf:"bytes,100,opt,name=approximate_last_used_time,proto3" json:"approximate_last_used_time,omitempty"`
// The time this AuthToken expires.
// Output only.
ExpirationTime *timestamp.Timestamp `protobuf:"bytes,100,opt,name=expiration_time,proto3" json:"expiration_time,omitempty"`
ExpirationTime *timestamp.Timestamp `protobuf:"bytes,110,opt,name=expiration_time,proto3" json:"expiration_time,omitempty"`
}
func (x *AuthToken) Reset() {
@ -141,6 +144,13 @@ func (x *AuthToken) GetAuthMethodId() string {
return ""
}
func (x *AuthToken) GetAccountId() string {
if x != nil {
return x.AccountId
}
return ""
}
func (x *AuthToken) GetCreatedTime() *timestamp.Timestamp {
if x != nil {
return x.CreatedTime
@ -185,7 +195,7 @@ var file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc = []byte
0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70,
0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0xf6, 0x03, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12,
0x6f, 0x22, 0x96, 0x04, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73,
@ -198,22 +208,24 @@ var file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc = []byte
0x64, 0x18, 0x32, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64,
0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f,
0x69, 0x64, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d,
0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61,
0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x46, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61,
0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61,
0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61,
0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61,
0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x5a, 0x0a, 0x1a, 0x61, 0x70, 0x70, 0x72,
0x6f, 0x78, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x73, 0x65,
0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x1a, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x78,
0x69, 0x6d, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x5f,
0x74, 0x69, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x5b, 0x5a, 0x59, 0x67, 0x69,

@ -31,23 +31,27 @@ message AuthToken {
// Output only.
string user_id = 50 [json_name="user_id"];
// The id of the user of this AuthToken.
// The id of the auth method of this AuthToken.
// Output only.
string auth_method_id = 60 [json_name="auth_method_id"];
// The id of the auth method account of this AuthToken.
// Output only.
string account_id = 70 [json_name="account_id"];
// The time this resource was created
// Output only.
google.protobuf.Timestamp created_time = 70 [json_name="created_time"];
google.protobuf.Timestamp created_time = 80 [json_name="created_time"];
// The time this resource was last updated.
// Output only.
google.protobuf.Timestamp updated_time = 80 [json_name="updated_time"];
google.protobuf.Timestamp updated_time = 90 [json_name="updated_time"];
// The approximate time this AuthToken was last used.
// Output only.
google.protobuf.Timestamp approximate_last_used_time = 90 [json_name = "approximate_last_used_time"];
google.protobuf.Timestamp approximate_last_used_time = 100 [json_name = "approximate_last_used_time"];
// The time this AuthToken expires.
// Output only.
google.protobuf.Timestamp expiration_time = 100 [json_name="expiration_time"];
google.protobuf.Timestamp expiration_time = 110 [json_name="expiration_time"];
}

@ -194,6 +194,7 @@ func toProto(in *authtoken.AuthToken) *pb.AuthToken {
ExpirationTime: in.GetExpirationTime().GetTimestamp(),
UserId: in.GetIamUserId(),
AuthMethodId: in.GetAuthMethodId(),
AccountId: in.GetAuthAccountId(),
}
return &out
}

@ -45,6 +45,7 @@ func TestGet(t *testing.T) {
ScopeId: at.GetScopeId(),
UserId: at.GetIamUserId(),
AuthMethodId: at.GetAuthMethodId(),
AccountId: at.GetAuthAccountId(),
CreatedTime: at.GetCreateTime().GetTimestamp(),
UpdatedTime: at.GetUpdateTime().GetTimestamp(),
ApproximateLastUsedTime: at.GetApproximateLastAccessTime().GetTimestamp(),
@ -117,6 +118,7 @@ func TestList(t *testing.T) {
ScopeId: at.GetScopeId(),
UserId: at.GetIamUserId(),
AuthMethodId: at.GetAuthMethodId(),
AccountId: at.GetAuthAccountId(),
CreatedTime: at.GetCreateTime().GetTimestamp(),
UpdatedTime: at.GetUpdateTime().GetTimestamp(),
ApproximateLastUsedTime: at.GetApproximateLastAccessTime().GetTimestamp(),
@ -134,6 +136,7 @@ func TestList(t *testing.T) {
ScopeId: at.GetScopeId(),
UserId: at.GetIamUserId(),
AuthMethodId: at.GetAuthMethodId(),
AccountId: at.GetAuthAccountId(),
CreatedTime: at.GetCreateTime().GetTimestamp(),
UpdatedTime: at.GetUpdateTime().GetTimestamp(),
ApproximateLastUsedTime: at.GetApproximateLastAccessTime().GetTimestamp(),

Loading…
Cancel
Save