Skip to content

Commit

Permalink
gRPC conversions - SSO Auth Connectors (#13073)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joerger authored Jun 8, 2022
1 parent ef37053 commit 9cc58cc
Show file tree
Hide file tree
Showing 35 changed files with 6,329 additions and 2,508 deletions.
67 changes: 67 additions & 0 deletions api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,25 @@ func (c *Client) DeleteOIDCConnector(ctx context.Context, name string) error {
return trail.FromGRPC(err)
}

// CreateOIDCAuthRequest creates OIDCAuthRequest.
func (c *Client) CreateOIDCAuthRequest(ctx context.Context, req types.OIDCAuthRequest) (*types.OIDCAuthRequest, error) {
resp, err := c.grpc.CreateOIDCAuthRequest(ctx, &req, c.callOpts...)
if err != nil {
return nil, trail.FromGRPC(err)
}
return resp, nil
}

// GetOIDCAuthRequest gets an OIDCAuthRequest by state token.
func (c *Client) GetOIDCAuthRequest(ctx context.Context, stateToken string) (*types.OIDCAuthRequest, error) {
req := &proto.GetOIDCAuthRequestRequest{StateToken: stateToken}
resp, err := c.grpc.GetOIDCAuthRequest(ctx, req, c.callOpts...)
if err != nil {
return nil, trail.FromGRPC(err)
}
return resp, nil
}

// GetSAMLConnector returns a SAML connector by name.
func (c *Client) GetSAMLConnector(ctx context.Context, name string, withSecrets bool) (types.SAMLConnector, error) {
if name == "" {
Expand Down Expand Up @@ -1609,6 +1628,25 @@ func (c *Client) DeleteSAMLConnector(ctx context.Context, name string) error {
return trail.FromGRPC(err)
}

// CreateSAMLAuthRequest creates SAMLAuthRequest.
func (c *Client) CreateSAMLAuthRequest(ctx context.Context, req types.SAMLAuthRequest) (*types.SAMLAuthRequest, error) {
resp, err := c.grpc.CreateSAMLAuthRequest(ctx, &req, c.callOpts...)
if err != nil {
return nil, trail.FromGRPC(err)
}
return resp, nil
}

// GetSAMLAuthRequest gets a SAMLAuthRequest by id.
func (c *Client) GetSAMLAuthRequest(ctx context.Context, id string) (*types.SAMLAuthRequest, error) {
req := &proto.GetSAMLAuthRequestRequest{ID: id}
resp, err := c.grpc.GetSAMLAuthRequest(ctx, req, c.callOpts...)
if err != nil {
return nil, trail.FromGRPC(err)
}
return resp, nil
}

// GetGithubConnector returns a Github connector by name.
func (c *Client) GetGithubConnector(ctx context.Context, name string, withSecrets bool) (types.GithubConnector, error) {
if name == "" {
Expand Down Expand Up @@ -1655,6 +1693,35 @@ func (c *Client) DeleteGithubConnector(ctx context.Context, name string) error {
return trail.FromGRPC(err)
}

// CreateGithubAuthRequest creates GithubAuthRequest.
func (c *Client) CreateGithubAuthRequest(ctx context.Context, req types.GithubAuthRequest) (*types.GithubAuthRequest, error) {
resp, err := c.grpc.CreateGithubAuthRequest(ctx, &req, c.callOpts...)
if err != nil {
return nil, trail.FromGRPC(err)
}
return resp, nil
}

// GetGithubAuthRequest gets a GithubAuthRequest by state token.
func (c *Client) GetGithubAuthRequest(ctx context.Context, stateToken string) (*types.GithubAuthRequest, error) {
req := &proto.GetGithubAuthRequestRequest{StateToken: stateToken}
resp, err := c.grpc.GetGithubAuthRequest(ctx, req, c.callOpts...)
if err != nil {
return nil, trail.FromGRPC(err)
}
return resp, nil
}

// GetSSODiagnosticInfo returns SSO diagnostic info records for a specific SSO Auth request.
func (c *Client) GetSSODiagnosticInfo(ctx context.Context, authRequestKind string, authRequestID string) (*types.SSODiagnosticInfo, error) {
req := &proto.GetSSODiagnosticInfoRequest{AuthRequestKind: authRequestKind, AuthRequestID: authRequestID}
resp, err := c.grpc.GetSSODiagnosticInfo(ctx, req, c.callOpts...)
if err != nil {
return nil, trail.FromGRPC(err)
}
return resp, nil
}

// GetTrustedCluster returns a Trusted Cluster by name.
func (c *Client) GetTrustedCluster(ctx context.Context, name string) (types.TrustedCluster, error) {
if name == "" {
Expand Down
Loading

0 comments on commit 9cc58cc

Please sign in to comment.