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 <112624398+rsemkin@users.noreply.github.com>
  • Loading branch information
iljaSL and rsemkin authored Nov 28, 2024
1 parent a21346a commit 2cf756d
Show file tree
Hide file tree
Showing 4 changed files with 50 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 @@ -46,6 +46,26 @@ func (auth *Client) CACertificate(caID, filename string) error {
return err
}

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

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

return caConf, err
}

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

return err
}

// CertificateRevocationList gets authorizer CA's certificate revocation list.
func (auth *Client) CertificateRevocationList(caID, filename string) error {
err := auth.api.
Expand Down
9 changes: 9 additions & 0 deletions api/authorizer/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,12 @@ type CheckoutResult struct {
Count int `json:"count"`
Items []Checkout `json:"items"`
}

// ComponentCaConfig component ca config response definition.
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 @@ -247,6 +247,17 @@ func (s *Client) RefreshTargetDomain(tdId string) error {
return err
}

// ResolveTargetDomains resolve target domain names to target domain IDs.
func (s *Client) 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
// TargetDomainAccounts lists all accounts in target domain
func (s *Client) TargetDomainAccounts(offset, limit int, sortkey, sortdir, tdId string) (ScannedAccountResult, 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 @@ -280,3 +280,13 @@ type ManagedAccountResult struct {
Count int `json:"count"`
Items []ManagedAccount `json:"items"`
}

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 2cf756d

Please sign in to comment.