Skip to content

Commit

Permalink
cleanup newEcsRAMRoleCredential method
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian authored and yndu13 committed Jul 26, 2024
1 parent 3ead6a3 commit aa59092
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
12 changes: 0 additions & 12 deletions credentials/ecs_ram_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ type ecsRAMRoleResponse struct {
Expiration string `json:"Expiration" xml:"Expiration"`
}

func newEcsRAMRoleCredential(roleName string, inAdvanceScale float64, runtime *utils.Runtime) *EcsRAMRoleCredential {
credentialUpdater := new(credentialUpdater)
if inAdvanceScale < 1 && inAdvanceScale > 0 {
credentialUpdater.inAdvanceScale = inAdvanceScale
}
return &EcsRAMRoleCredential{
RoleName: roleName,
credentialUpdater: credentialUpdater,
runtime: runtime,
}
}

func newEcsRAMRoleCredentialWithEnableIMDSv2(roleName string, enableIMDSv2 bool, metadataTokenDuration int, inAdvanceScale float64, runtime *utils.Runtime) *EcsRAMRoleCredential {
credentialUpdater := new(credentialUpdater)
if inAdvanceScale < 1 && inAdvanceScale > 0 {
Expand Down
8 changes: 7 additions & 1 deletion credentials/ecs_ram_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import (
)

func Test_EcsRAmRoleCredential(t *testing.T) {
auth := newEcsRAMRoleCredential("go sdk", 0.5, nil)
credentialUpdater := new(credentialUpdater)
credentialUpdater.inAdvanceScale = 0.5
auth := &EcsRAMRoleCredential{
RoleName: "go sdk",
credentialUpdater: credentialUpdater,
runtime: nil,
}
origTestHookDo := hookDo
defer func() { hookDo = origTestHookDo }()

Expand Down

0 comments on commit aa59092

Please sign in to comment.