Documentation
¶
Overview ¶
Package graphql provides direct access to the RSC GraphQL API. Can be used to execute both raw queries and prepared low-level queries used by the high-level part of the SDK.
The graphql package tries to stay as close as possible to the GraphQL API:
- Get as a prefix is dropped.
- Names are turned into CamelCase.
- CSP acronyms (e.g. aws) that are part of names are removed.
- Query parameters with values in a well-defined range are turned into types.
Index ¶
- Variables
- func QueryName(query string) string
- func RequestError(query string, err error) error
- func ResponseError(query string, err error) error
- func UnmarshalError(query string, err error) error
- func VersionOlderThan(version string, versionTags ...string) booldeprecated
- type Client
- func NewClient(apiURL string, tokenSource token.Source) *Client
- func NewClientFromLocalUser(app, apiURL, username, password string, logger log.Logger) *Clientdeprecated
- func NewClientFromServiceAccount(app, apiURL, accessTokenURI, clientID, clientSecret string, logger log.Logger) *Clientdeprecated
- func NewClientWithLogger(apiURL string, tokenSource token.Source, logger log.Logger) *Client
- func NewTestClient(testServer *httptest.Server) *Client
- func NewTestClientWithTokenSource(testServer *httptest.Server, tokenSource token.Source) *Client
- func (c *Client) DeploymentVersion(ctx context.Context) (Version, error)
- func (c *Client) Log() log.Logger
- func (c *Client) Request(ctx context.Context, query string, variables any) ([]byte, error)
- func (c *Client) RequestWithoutLogging(ctx context.Context, query string, variables interface{}) ([]byte, error)
- func (c *Client) RequestWithoutRetry(ctx context.Context, query string, variables interface{}) ([]byte, error)
- func (c *Client) SetLogger(logger log.Logger)
- type GQLError
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound signals that the specified entity could not be found. ErrNotFound = errors.New("not found") )
Functions ¶
func RequestError ¶ added in v0.10.0
RequestError returns a standard formatted error detailing the failure when calling a query/mutation.
func ResponseError ¶ added in v0.10.0
ResponseError returns a standard formatted error detailing the error received in response to a query/mutation.
func UnmarshalError ¶ added in v0.10.0
UnmarshalError returns a standard formatted error detailing the failure to unmarshal the response from a GraphQL query/mutation.
func VersionOlderThan
deprecated
added in
v0.0.17
Types ¶
type Client ¶
type Client struct { Version string // Deprecated: use DeploymentVersion. // contains filtered or unexported fields }
Client is used to make GraphQL calls to the Polaris platform.
func NewClientFromLocalUser
deprecated
func NewClientFromServiceAccount
deprecated
func NewClientWithLogger ¶ added in v0.7.0
NewClientWithLogger returns a new Client for the specified API URL, logging to the given logger.
func NewTestClient ¶
NewTestClient returns a new Client intended to be used by unit tests.
func NewTestClientWithTokenSource ¶ added in v1.1.0
NewTestClientWithTokenSource returns a new Client with a custom token source intended to be used by unit tests.
func (*Client) DeploymentVersion ¶ added in v0.7.0
DeploymentVersion returns the deployed version of RSC.
func (*Client) Request ¶
Request posts the specified GraphQL query/mutation with the given variables to the Polaris platform. Returns the response JSON text as is. If the request fails due to temporary error, it will be retried automatically.
func (*Client) RequestWithoutLogging ¶ added in v0.10.0
func (c *Client) RequestWithoutLogging(ctx context.Context, query string, variables interface{}) ([]byte, error)
RequestWithoutLogging posts the specified GraphQL query/mutation with the given variables to the Polaris platform. Returns the response JSON text as is. The variables are not logged before the request is made. Certain temporary errors will be retried.
func (*Client) RequestWithoutRetry ¶ added in v0.9.1
func (c *Client) RequestWithoutRetry(ctx context.Context, query string, variables interface{}) ([]byte, error)
RequestWithoutRetry posts the specified GraphQL query/mutation with the given variables to the Polaris platform. Returns the response JSON text as is.
type GQLError ¶ added in v0.6.0
type GQLError struct { Data interface{} `json:"data"` Errors []struct { Message string `json:"message"` Path []interface{} `json:"path"` Locations []struct { Line int `json:"line"` Column int `json:"column"` } `json:"locations"` Extensions struct { Code int `json:"code"` Trace struct { Operation string `json:"operation"` TraceID string `json:"traceId"` SpanID string `json:"spanId"` } `json:"trace"` } `json:"extensions"` } `json:"errors"` }
GQLError is returned by RSC in the body of a response as a JSON document when certain types of GraphQL errors occur.
Directories
¶
Path | Synopsis |
---|---|
Package access provides a low level interface to the users, groups and roles management GraphQL queries provided by the RSC platform.
|
Package access provides a low level interface to the users, groups and roles management GraphQL queries provided by the RSC platform. |
Package aws provides a low-level interface to the AWS GraphQL queries provided by the Polaris platform.
|
Package aws provides a low-level interface to the AWS GraphQL queries provided by the Polaris platform. |
Package azure provides a low-level interface to the Azure GraphQL queries provided by the Polaris platform.
|
Package azure provides a low-level interface to the Azure GraphQL queries provided by the Polaris platform. |
Package core provides a low-level interface to core GraphQL queries provided by the Polaris platform.
|
Package core provides a low-level interface to core GraphQL queries provided by the Polaris platform. |
Package gcp provides a low level interface to the GCP GraphQL queries provided by the RSC platform.
|
Package gcp provides a low level interface to the GCP GraphQL queries provided by the RSC platform. |