Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.0
0.12.1
2 changes: 1 addition & 1 deletion entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Entries struct {
}

type Entry struct {
ID string `json:"id,omitempty"`
Id string `json:"id,omitempty"`
VaultId string `json:"vaultId,omitempty"`
Name string `json:"name"`
Path string `json:"path"`
Expand Down
10 changes: 5 additions & 5 deletions entry_attachments.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
)

type EntryAttachment struct {
ID string `json:"id,omitempty"`
IDString string `json:"idString"`
EntryID string `json:"connectionID"`
EntryIDString string `json:"connectionIDString"`
Id string `json:"id,omitempty"`
IdString string `json:"idString"`
EntryId string `json:"connectionID"`
EntryIdString string `json:"connectionIDString"`
Description string `json:"description"`
FileName string `json:"filename"`
IsPrivate bool `json:"isPrivate"`
Expand Down Expand Up @@ -67,7 +67,7 @@ func (c *Client) newAttachmentRequest(attachment EntryAttachment) (string, error
return "", fmt.Errorf("failed to unmarshal response body. error: %w", err)
}

return attachment.ID, nil
return attachment.Id, nil
}

func (c *Client) uploadAttachment(fileBytes []byte, attachmentId string) error {
Expand Down
14 changes: 7 additions & 7 deletions entry_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type EntryCertificateService service

// EntryCertificate represents a certificate entry.
type EntryCertificate struct {
ID string
Id string
VaultId string
Name string
Description string
Expand All @@ -31,7 +31,7 @@ type EntryCertificate struct {
}

type rawEntryCertificate struct {
ID string `json:"id,omitempty"`
Id string `json:"id,omitempty"`
VaultId string `json:"repositoryId"`
Name string `json:"name"`
Description string `json:"description"`
Expand Down Expand Up @@ -61,7 +61,7 @@ type entryCertificateData struct {
// MarshalJSON implements the json.Marshaler interface.
func (e EntryCertificate) MarshalJSON() ([]byte, error) {
raw := rawEntryCertificate{
ID: e.ID,
Id: e.Id,
VaultId: e.VaultId,
Name: e.Name,
Description: e.Description,
Expand Down Expand Up @@ -121,7 +121,7 @@ func (e *EntryCertificate) UnmarshalJSON(d []byte) error {
}
}

e.ID = raw.Data.ID
e.Id = raw.Data.Id
e.VaultId = raw.Data.VaultId
e.Name = raw.Data.Name
e.Description = raw.Data.Description
Expand Down Expand Up @@ -179,7 +179,7 @@ func (c *EntryCertificateService) GetFileContent(entryId string) ([]byte, error)
// GetPassword returns the password of the entry specified by entry.
func (c *EntryCertificateService) GetPassword(entry EntryCertificate) (EntryCertificate, error) {
var entryPassword EntryCertificate
reqUrl, err := url.JoinPath(c.client.baseUri, entryEndpoint, entry.ID, "/sensitive-data")
reqUrl, err := url.JoinPath(c.client.baseUri, entryEndpoint, entry.Id, "/sensitive-data")
if err != nil {
return EntryCertificate{}, fmt.Errorf("failed to build entry url. error: %w", err)
}
Expand Down Expand Up @@ -243,7 +243,7 @@ func (c *EntryCertificateService) new(entry EntryCertificate, content []byte) (E

if content != nil {
attachment := EntryAttachment{
EntryID: entry.ID,
EntryId: entry.Id,
FileName: entry.CertificateIdentifier,
Size: len(content),
IsPrivate: true,
Expand All @@ -265,7 +265,7 @@ func (c *EntryCertificateService) new(entry EntryCertificate, content []byte) (E

// Update updates an EntryCertificate based on entry. Will replace all other fields whether included or not.
func (c *EntryCertificateService) Update(entry EntryCertificate) (EntryCertificate, error) {
oldEntry, err := c.Get(entry.ID)
oldEntry, err := c.Get(entry.Id)
if err != nil {
return EntryCertificate{}, fmt.Errorf("error while fetching entry. error: %w", err)
}
Expand Down
18 changes: 9 additions & 9 deletions entry_certificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
func Test_EntryCertificate(t *testing.T) {
testCertificateFilePath = os.Getenv("TEST_CERTIFICATE_FILE_PATH")
testCertificateEntryId = os.Getenv("TEST_CERTIFICATE_ENTRY_ID")
testCertificateEntry.ID = testCertificateEntryId
testCertificateEntry.Id = testCertificateEntryId
testCertificateEntry.VaultId = testVaultId
location, err := time.LoadLocation("America/Montreal")
if err != nil {
Expand All @@ -44,7 +44,7 @@ func Test_EntryCertificate(t *testing.T) {
func test_GetCertificateEntry(t *testing.T) {
testGetEntry := testCertificateEntry

entry, err := testClient.Entries.Certificate.Get(testGetEntry.ID)
entry, err := testClient.Entries.Certificate.Get(testGetEntry.Id)
if err != nil {
t.Fatal(err)
}
Expand All @@ -69,7 +69,7 @@ func test_GetCertificateEntry(t *testing.T) {

func test_NewCertificateEntryFile(t *testing.T) {
entry := testCertificateEntry
entry.ID = ""
entry.Id = ""
file, err := os.Open(testCertificateFilePath)
if err != nil {
t.Fatal(err)
Expand All @@ -93,7 +93,7 @@ func test_NewCertificateEntryFile(t *testing.T) {
t.Fatal(err)
}

returnedFileBytes, err := testClient.Entries.Certificate.GetFileContent(newEntry.ID)
returnedFileBytes, err := testClient.Entries.Certificate.GetFileContent(newEntry.Id)
if err != nil {
t.Fatal(err)
}
Expand All @@ -102,7 +102,7 @@ func test_NewCertificateEntryFile(t *testing.T) {
t.Fatalf("fetched file content did not match test file content. Expected %#v, got %#v", fileBytes, returnedFileBytes)
}

entry.ID = newEntry.ID
entry.Id = newEntry.Id
entry.data = newEntry.data
newEntry, err = testClient.Entries.Certificate.GetPassword(newEntry)
if err != nil {
Expand All @@ -124,15 +124,15 @@ func test_NewCertificateEntryFile(t *testing.T) {

func test_NewCertificateEntryURL(t *testing.T) {
entry := testCertificateEntry
entry.ID = ""
entry.Id = ""
entry.CertificateIdentifier = "https://devolutions.net/"

newEntry, err := testClient.Entries.Certificate.NewURL(entry)
if err != nil {
t.Fatal(err)
}

entry.ID = newEntry.ID
entry.Id = newEntry.Id
entry.data = newEntry.data
newEntry, err = testClient.Entries.Certificate.GetPassword(newEntry)
if err != nil {
Expand Down Expand Up @@ -177,12 +177,12 @@ func test_UpdateCertificateEntry(t *testing.T) {
}

func test_DeleteCertificateEntry(t *testing.T) {
err := testClient.Entries.Certificate.Delete(testNewCertificateEntryURL.ID)
err := testClient.Entries.Certificate.Delete(testNewCertificateEntryURL.Id)
if err != nil {
t.Fatal(err)
}

err = testClient.Entries.Certificate.Delete(testNewCertificateEntryFile.ID)
err = testClient.Entries.Certificate.Delete(testNewCertificateEntryFile.Id)
if err != nil {
t.Fatal(err)
}
Expand Down
30 changes: 15 additions & 15 deletions entry_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ type EntryCredentialAccessCodeData struct {
}

type EntryCredentialApiKeyData struct {
ApiID string `json:"apiId,omitempty"`
ApiId string `json:"apiId,omitempty"`
ApiKey string `json:"apiKey,omitempty"`
TenantID string `json:"tenantId,omitempty"`
TenantId string `json:"tenantId,omitempty"`
}

type EntryCredentialAzureServicePrincipalData struct {
ClientID string `json:"clientId,omitempty"`
ClientId string `json:"clientId,omitempty"`
ClientSecret string `json:"clientSecret,omitempty"`
TenantID string `json:"tenantId,omitempty"`
TenantId string `json:"tenantId,omitempty"`
}

type EntryCredentialConnectionStringData struct {
Expand Down Expand Up @@ -145,13 +145,13 @@ func (c *EntryCredentialService) validateEntry(entry *Entry) error {

// Get returns a single EntryCredential
func (c *EntryCredentialService) Get(entry Entry) (Entry, error) {
return c.GetById(entry.VaultId, entry.ID)
return c.GetById(entry.VaultId, entry.Id)
}

// Get returns a single EntryCredential based on vault ID and entry ID.
// Get returns a single EntryCredential based on vault Id and entry Id.
func (c *EntryCredentialService) GetById(vaultId string, entryId string) (Entry, error) {
if vaultId == "" || entryId == "" {
return Entry{}, fmt.Errorf("both entry ID and vault ID are required")
return Entry{}, fmt.Errorf("both entry Id and vault Id are required")
}

var entry Entry
Expand Down Expand Up @@ -234,8 +234,8 @@ func (c *EntryCredentialService) Update(entry Entry) (Entry, error) {
return Entry{}, err
}

if entry.ID == "" {
return Entry{}, fmt.Errorf("entry ID is required for updates")
if entry.Id == "" {
return Entry{}, fmt.Errorf("entry Id is required for updates")
}

updateEntryRequest := struct {
Expand All @@ -252,7 +252,7 @@ func (c *EntryCredentialService) Update(entry Entry) (Entry, error) {
Tags: entry.Tags,
}

entryUri := entryPublicEndpointReplacer(entry.VaultId, entry.ID)
entryUri := entryPublicEndpointReplacer(entry.VaultId, entry.Id)
reqUrl, err := url.JoinPath(c.client.baseUri, entryUri)
if err != nil {
return Entry{}, fmt.Errorf("failed to build entry url. error: %w", err)
Expand All @@ -268,7 +268,7 @@ func (c *EntryCredentialService) Update(entry Entry) (Entry, error) {
return Entry{}, fmt.Errorf("error while updating entry. error: %w", err)
}

entry, err = c.GetById(entry.VaultId, entry.ID)
entry, err = c.GetById(entry.VaultId, entry.Id)
if err != nil {
return Entry{}, fmt.Errorf("update succeeded but failed to fetch updated entry: %w", err)
}
Expand All @@ -278,13 +278,13 @@ func (c *EntryCredentialService) Update(entry Entry) (Entry, error) {

// Delete deletes an entry
func (c *EntryCredentialService) Delete(e Entry) error {
return c.DeleteByID(e.VaultId, e.ID)
return c.DeleteById(e.VaultId, e.Id)
}

// Delete deletes an entry based on vault ID and entry ID
func (c *EntryCredentialService) DeleteByID(vaultId string, entryId string) error {
// Delete deletes an entry based on vault Id and entry Id
func (c *EntryCredentialService) DeleteById(vaultId string, entryId string) error {
if vaultId == "" || entryId == "" {
return fmt.Errorf("both entry ID and vault ID are required")
return fmt.Errorf("both entry Id and vault Id are required")
}

entryUri := entryPublicEndpointReplacer(vaultId, entryId)
Expand Down
Loading
Loading