Skip to content

Commit

Permalink
feat: add missing godocs
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Aug 6, 2024
1 parent 5e8e75e commit fc07a6a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/juju/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type SecretAPIClient interface {
RevokeSecret(uri *secrets.URI, name string, apps []string) ([]error, error)
}

// JaasAPIClient defines the set of methods that the JAAS API provides.
type JaasAPIClient interface {
ListRelationshipTuples(req *jaasparams.ListRelationshipTuplesRequest) (*jaasparams.ListRelationshipTuplesResponse, error)
AddRelation(req *jaasparams.AddRelationRequest) error
Expand Down
5 changes: 4 additions & 1 deletion internal/juju/jaas.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Canonical Ltd.
// Copyright 2024 Canonical Ltd.
// Licensed under the Apache License, Version 2.0, see LICENCE file for details.

package juju
Expand All @@ -25,6 +25,7 @@ func newJaasClient(sc SharedClient) *jaasClient {
}
}

// AddRelations attempts to create the provided slice of relationship tuples.
func (jc *jaasClient) AddRelations(tuples []params.RelationshipTuple) error {
conn, err := jc.GetConnection(nil)
if err != nil {
Expand All @@ -38,6 +39,7 @@ func (jc *jaasClient) AddRelations(tuples []params.RelationshipTuple) error {
return cl.AddRelation(&req)
}

// DeleteRelations attempts to delete the provided slice of relationship tuples.
func (jc *jaasClient) DeleteRelations(tuples []params.RelationshipTuple) error {
conn, err := jc.GetConnection(nil)
if err != nil {
Expand All @@ -51,6 +53,7 @@ func (jc *jaasClient) DeleteRelations(tuples []params.RelationshipTuple) error {
return cl.RemoveRelation(&req)
}

// ReadRelations attempts to read relations that match the criteria defined by `tuple`.
func (jc *jaasClient) ReadRelations(tuple *params.RelationshipTuple) ([]params.RelationshipTuple, error) {
if tuple == nil {
return nil, errors.New("add relation request nil")
Expand Down
2 changes: 1 addition & 1 deletion internal/juju/jaas_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Canonical Ltd.
// Copyright 2024 Canonical Ltd.
// Licensed under the Apache License, Version 2.0, see LICENCE file for details.

package juju
Expand Down

0 comments on commit fc07a6a

Please sign in to comment.