diff --git a/management/encryption_key.go b/management/encryption_key.go index d7e25612..6751a5e0 100644 --- a/management/encryption_key.go +++ b/management/encryption_key.go @@ -5,12 +5,6 @@ import ( "time" ) -// EncryptionKeyList is a list of encryption keys. -type EncryptionKeyList struct { - List - Keys []*EncryptionKey `json:"keys"` -} - // EncryptionKey is used for encrypting data. type EncryptionKey struct { // Key ID @@ -70,8 +64,8 @@ func (m *EncryptionKeyManager) Create(ctx context.Context, e *EncryptionKey, opt // List all encryption keys. // // See: https://auth0.com/docs/api/management/v2/keys/get-encryption-keys -func (m *EncryptionKeyManager) List(ctx context.Context, opts ...RequestOption) (ekl *EncryptionKeyList, err error) { - err = m.management.Request(ctx, "GET", m.management.URI("keys", "encryption"), &ekl, applyListDefaults(opts)) +func (m *EncryptionKeyManager) List(ctx context.Context, opts ...RequestOption) (keys []*EncryptionKey, err error) { + err = m.management.Request(ctx, "GET", m.management.URI("keys", "encryption"), &keys, opts...) return } diff --git a/management/encryption_key_test.go b/management/encryption_key_test.go index 539b3ef4..ccd21d19 100644 --- a/management/encryption_key_test.go +++ b/management/encryption_key_test.go @@ -49,9 +49,9 @@ func TestEncryptionKeyManager_Create(t *testing.T) { func TestEncryptionKeyManager_List(t *testing.T) { configureHTTPTestRecordings(t) key := givenEncryptionKey(t) - keyList, err := api.EncryptionKey.List(context.Background(), PerPage(50), Page(0)) + keys, err := api.EncryptionKey.List(context.Background(), PerPage(50), Page(0)) assert.NoError(t, err) - assert.Contains(t, keyList.Keys, key) + assert.Contains(t, keys, key) } func TestEncryptionKeyManager_Read(t *testing.T) { @@ -64,12 +64,12 @@ func TestEncryptionKeyManager_Read(t *testing.T) { func TestEncryptionKeyManager_Rekey(t *testing.T) { configureHTTPTestRecordings(t) - oldKeyList, err := api.EncryptionKey.List(context.Background(), PerPage(50), Page(0)) + oldKeys, err := api.EncryptionKey.List(context.Background(), PerPage(50), Page(0)) assert.NoError(t, err) - assert.NotEmpty(t, oldKeyList.Keys) + assert.NotEmpty(t, oldKeys) var oldKey, newKey *EncryptionKey - for _, key := range oldKeyList.Keys { + for _, key := range oldKeys { if key.GetState() == "active" && key.GetType() == "tenant-master-key" { oldKey = key break @@ -80,11 +80,11 @@ func TestEncryptionKeyManager_Rekey(t *testing.T) { err = api.EncryptionKey.Rekey(context.Background()) assert.NoError(t, err) - keyList, err := api.EncryptionKey.List(context.Background(), PerPage(50), Page(0)) + keys, err := api.EncryptionKey.List(context.Background(), PerPage(50), Page(0)) assert.NoError(t, err) - assert.NotEmpty(t, keyList.Keys) + assert.NotEmpty(t, keys) - for _, key := range keyList.Keys { + for _, key := range keys { if key.GetState() == "active" && key.GetType() == "tenant-master-key" { newKey = key break @@ -93,7 +93,7 @@ func TestEncryptionKeyManager_Rekey(t *testing.T) { assert.NotNil(t, newKey) assert.NotEqual(t, oldKey.GetKID(), newKey.GetKID()) - assert.NotEqual(t, keyList.Keys, oldKeyList.Keys) + assert.NotEqual(t, keys, oldKeys) } func TestEncryptionKeyManager_Delete(t *testing.T) { diff --git a/management/management.gen.go b/management/management.gen.go index 37a43c89..448c6a54 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -6807,11 +6807,6 @@ func (e *EncryptionKey) String() string { return Stringify(e) } -// String returns a string representation of EncryptionKeyList. -func (e *EncryptionKeyList) String() string { - return Stringify(e) -} - // GetEnrolledAt returns the EnrolledAt field if it's non-nil, zero value otherwise. func (e *Enrollment) GetEnrolledAt() time.Time { if e == nil || e.EnrolledAt == nil { diff --git a/management/management.gen_test.go b/management/management.gen_test.go index c8fe6831..9a31e1c0 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -8449,14 +8449,6 @@ func TestEncryptionKey_String(t *testing.T) { } } -func TestEncryptionKeyList_String(t *testing.T) { - var rawJSON json.RawMessage - v := &EncryptionKeyList{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - func TestEnrollment_GetEnrolledAt(tt *testing.T) { var zeroValue time.Time e := &Enrollment{EnrolledAt: &zeroValue}