Skip to content

Commit

Permalink
feat(1.37.0): add new auhtorizer and secrets manager endpoints and mo…
Browse files Browse the repository at this point in the history
…dels (#167)

Co-authored-by: rsemkin <[email protected]>
  • Loading branch information
2 people authored and iljassh committed Nov 28, 2024
1 parent 5c542f6 commit 2e6fcf5
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
20 changes: 20 additions & 0 deletions api/authorizer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@ func (c *Authorizer) DownloadCACertificate(caID, filename string) error {
return err
}

// CAConfig get authorizers root certificate config by ca type.
func (c *Authorizer) CAConfig(caType string) (ComponentCaConfig, error) {
caConf := ComponentCaConfig{}

_, err := c.api.
URL("/authorizer/api/v1/%s/cas/config", caType).
Get(&caConf)

return caConf, err
}

// UpdateCAConfig update authorizers root certificate config by ca type.
func (c *Authorizer) UpdateCAConfig(caType string, caConf ComponentCaConfig) error {
_, err := c.api.
URL("/authorizer/api/v1/%s/cas/config", caType).
Put(&caConf)

return err
}

// DownloadCertificateRevocationList fetch authorizer CA certificate revocation list as a download object.
func (c *Authorizer) DownloadCertificateRevocationList(caID, filename string) error {
err := c.api.
Expand Down
8 changes: 8 additions & 0 deletions api/authorizer/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,11 @@ type Secrets struct {
Secret string `json:"secret"`
Created time.Time `json:"created"`
}

type ComponentCaConfig struct {
Name string `json:"name"`
CAID string `json:"ca_id"`
PrimaryCAID string `json:"primary_ca_id"`
Updated time.Time `json:"updated"`
UpdatedBy string `json:"updated_by,omitempty"`
}
11 changes: 11 additions & 0 deletions api/secretsmanager/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,17 @@ func (c *SecretsManager) RefreshTargetDomain(tdID string) error {
return err
}

// ResolveTargetDomains resolve target domain names to target domain IDs.
func (s *SecretsManager) ResolveTargetDomains(tdNames []string) (TargetDomainsResolveResponse, error) {
resolve := TargetDomainsResolveResponse{}

_, err := s.api.
URL("/secrets-manager/api/v1/targetdomains/resolve").
Post(tdNames, &resolve)

return resolve, err
}

// MARK: Target domain accounts
// GetTargetDomainAccounts get accounts in target domain.
func (c *SecretsManager) GetTargetDomainAccounts(tdID string, opts ...filters.Option) (*response.ResultSet[ScannedAccount], error) {
Expand Down
10 changes: 10 additions & 0 deletions api/secretsmanager/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,13 @@ type ManagedAccountDeleteBatch struct {
type ManagedAccountRotateBatch struct {
IDs []string `json:"ids"`
}

type TargetDomainsResolveResponse struct {
Count int `json:"count"`
Items []TargetDomainsResolve `json:"items"`
}

type TargetDomainsResolve struct {
ID string `json:"id"`
TargetDomainName string `json:"target_domain_name"`
}

0 comments on commit 2e6fcf5

Please sign in to comment.