Documentation
¶
Index ¶
- Constants
- Variables
- func Error(err error) error
- func ErrorDesc(err error) string
- func NewError(code codes.Code, msgFormat string, vals ...interface{}) error
- type APIKey
- type ApproveOrgRequest
- type AuthStsURLResponse
- type AuthTokenRefreshResponse
- type Authorization
- type CancelSubscriptionRequest
- type CancelSubscriptionResponse
- type Certificate
- type CertificatesResponse
- type CreateSubscriptionRequest
- type CreateSubscriptionResponse
- type DeleteOrgRequest
- type FccContactResponse
- type FccFrnResponse
- type Filer
- type FilerIDInfo
- type GetOrgAPIKeysResponse
- type GetOrgMembershipsResponse
- type HQAdress
- type ListSubscriptionsResponse
- type OpenCorporatesCompany
- type OrgMemberInfo
- type OrgMemberRequest
- type OrgMembersResponse
- type OrgMembership
- type OrgResponse
- type Organization
- type OrgsResponse
- type Product
- type RegisterOrgRequest
- type RepositoriesResponse
- type Repository
- type SearchOpenCorporatesResponse
- type StripeWebhookResponse
- type Subscription
- type SubscriptionsProductsResponse
- type TrustyError
- type UserInfo
- type ValidateOrgRequest
- type ValidateOrgResponse
Constants ¶
const ( // PathForStatus is base path for the Status service PathForStatus = "/v1/status" // PathForStatusVersion returns ServerVersion, // that proviodes the version of the installed package. // // Verbs: GET // Response: v1.ServerVersion PathForStatusVersion = "/v1/status/version" // PathForStatusServer returns ServerStatusResponse. // // Verbs: GET // Response: v1.ServerStatusResponse PathForStatusServer = "/v1/status/server" // PathForStatusNode returns `ALIVE` if the server is ready to server, // or 503 Service Unavailable otherwise. // This end-point can be used with Load Balancers // // Verbs: GET // Response: string // Content-Type: text/plain PathForStatusNode = "/v1/status/node" // PathForStatusCaller returns CallerStatusResponse. // // Verbs: GET // Response: v1.CallerStatusResponse PathForStatusCaller = "/v1/status/caller" // PathForSwagger returns swagger file. // // Verbs: GET // Response: JSON PathForSwagger = "/v1/swagger/:service" // PathForMetrics returns metrics. // // Verbs: GET PathForMetrics = "/v1/metrics" )
Status service API
const ( // PathForAuth is base path for the Auth service PathForAuth = "/v1/auth" // PathForAuthURL returns Auth URL // // Verbs: GET // Parameters: // redirect_url // device_id // sts // Response: v1.AuthStsURLResponse PathForAuthURL = "/v1/auth/url" // PathForAuthDone receives authenticated code and prints it // // Verbs: GET // Response: v1.PathForAuthDone PathForAuthDone = "/v1/auth/done" // PathForAuthTokenRefresh returns access token // // Verbs: GET // Response: v1.AuthTokenRefreshResponse PathForAuthTokenRefresh = "/v1/auth/token/refresh" // PathForAuthGithub is base path for the Auth service PathForAuthGithub = "/v1/auth/github" // PathForAuthGithubCallback is auth callback for github PathForAuthGithubCallback = "/v1/auth/github/callback" // PathForAuthGoogleCallback is auth callback for google PathForAuthGoogleCallback = "/v1/auth/google/callback" )
Auth service API
const ( // PathForWorkflow is base path for the Workflow service PathForWorkflow = "/v1/wf" // PathForWorkflowRepos provides repos for the user // // Verbs: GET // Response: v1.RepositoriesResponse PathForWorkflowRepos = "/v1/wf/:provider/repos" // PathForWorkflowOrgs provides orgs the user // // Verbs: GET // Response: v1.OrgsResponse PathForWorkflowOrgs = "/v1/wf/:provider/orgs" // PathForWorkflowSyncOrgs sync orgs the user // // Verbs: GET // Response: v1.OrgsResponse PathForWorkflowSyncOrgs = "/v1/wf/:provider/sync_orgs" )
Workflow service API
const ( // PathForCIS is base path for the CIS service PathForCIS = "/v1/cis" // PathForCISRoots provides Roots certificates // // Verbs: GET // Response: RootsResponse PathForCISRoots = "/v1/cis/roots" )
CIS service API
const ( // PathForCA is base path for the CA service PathForCA = "/v1/ca" // PathForCAIssuers provides Issuer certificates // // Verbs: GET // Response: IssuersInfoResponse PathForCAIssuers = "/v1/ca/issuers" // PathForCAProfileInfo provides profile information // // Verbs: GET // Response: CertProfileInfo PathForCAProfileInfo = "/v1/ca/csr/profile_info" )
CA service API
const ( // PathForMartini is base path for the Martini service PathForMartini = "/v1/ms" // PathForMartiniSearchCorps provides Search Open Corporates // // Verbs: GET // Response: SearchOpenCorporatesResponse PathForMartiniSearchCorps = "/v1/ms/search/opencorporates" // PathForMartiniSearchOrgs provides search for Organization // // Verbs: GET // Response: v1.OrgsResponse PathForMartiniSearchOrgs = "/v1/ms/search/orgs" // PathForMartiniFccFrn is path to get company FRN (Registration Number -CORESID) PathForMartiniFccFrn = "/v1/ms/fcc_frn" // PathForMartiniFccContact is path to get company details PathForMartiniFccContact = "/v1/ms/fcc_contact" // PathForMartiniRegisterOrg provides Org registration // // Verbs: POST // Response: v1.RegisterOrgResponse PathForMartiniRegisterOrg = "/v1/ms/orgs/register" // PathForMartiniValidateOrg sends Org validation request to Approver // // Verbs: POST // Response: v1.OrgResponse PathForMartiniValidateOrg = "/v1/ms/orgs/validate" // PathForMartiniApproveOrg provides Org approval // // Verbs: POST // Response: v1.OrgResponse PathForMartiniApproveOrg = "/v1/ms/orgs/approve" // PathForMartiniDeleteOrg provides Org deletion // // Verbs: POST // Response: v1.OrgResponse PathForMartiniDeleteOrg = "/v1/ms/orgs/delete" // PathForMartiniOrgs provides orgs the user belongs to // // Verbs: GET // Response: v1.OrgsResponse PathForMartiniOrgs = "/v1/ms/orgs" // PathForMartiniOrgByID provides org response // // Verbs: GET // Response: v1.OrgsResponse PathForMartiniOrgByID = "/v1/ms/orgs/:org_id" // PathForMartiniOrgMembers provides orgs the user belongs to // // Verbs: GET|POST // Response: v1.GetOrgMembersResponse PathForMartiniOrgMembers = "/v1/ms/members/:org_id" // PathForMartiniCerts provides certs from all orgs the user belongs to // // Verbs: GET // Response: v1.certsResponse PathForMartiniCerts = "/v1/ms/certificates" // PathForMartiniOrgAPIKeys provides org API keys // // Verbs: GET // Response: v1.OrgAPIKeysResponse PathForMartiniOrgAPIKeys = "/v1/ms/apikeys/:org_id" // PathForMartiniCreateSubscription creates Org subscription // // Verbs: POST // Response: v1.CreateSubscriptionResponse PathForMartiniCreateSubscription = "/v1/ms/subscription/create" // PathForMartiniCancelSubscription cancels Org subscription // // Verbs: POST // Response: v1.CancelSubscriptionResponse PathForMartiniCancelSubscription = "/v1/ms/subscription/cancel" // PathForMartiniListSubscriptions lists user's subscriptions // // Verbs: GET // Response: v1.ListSubscriptionsResponse PathForMartiniListSubscriptions = "/v1/ms/subscriptions" // PathForMartiniSubscriptionsProducts list products // // Verbs: GET // Response: v1.SubscriptionsProductsResponse PathForMartiniSubscriptionsProducts = "/v1/ms/subscriptions/products" // PathForMartiniStripeWebhook handles Stripe webhook call // // Verbs: POST // Response: v1.StripeWebhookResponse PathForMartiniStripeWebhook = "/v1/ms/stripe_webhook" )
Martini service API
const ( // ProviderGithub specifies name for Github ProviderGithub = "github" // ProviderGoogle specifies name for Google ProviderGoogle = "google" // ProviderMartini specifies name for Martini ProviderMartini = "martini" )
const ( // RoleAdmin specifies name for Admin role RoleAdmin = "admin" // RoleOwner specifies name for Owner role RoleOwner = "owner" // RoleUser specifies name for User role RoleUser = "user" )
const ( // OrgStatusUnknown is the default status OrgStatusUnknown = "unknown" // OrgStatusPaymentPending is assigned after the Org is registered and the client has to pay OrgStatusPaymentPending = "payment_pending" // OrgStatusPaymentProcessing is assigned after the subscription is created and payment posted OrgStatusPaymentProcessing = "payment_processing" // OrgStatusPaid specifies that the payment received OrgStatusPaid = "paid" // OrgStatusValidationPending specifies that validation request has been sent OrgStatusValidationPending = "validation_pending" // OrgStatusApproved specifies that Approver has approved the Organization OrgStatusApproved = "approved" // OrgStatusRevoked specifies that validation has beed revoked OrgStatusRevoked = "revoked" // OrgStatusDeactivated specifies that Organization has been deactivated, subsciption cancelled OrgStatusDeactivated = "deactivated" // OrgStatusDenied specifies that the approver denied the request OrgStatusDenied = "denied" )
Variables ¶
var ( ErrGRPCTimeout = status.New(codes.Unavailable, "trusty: request timed out").Err() ErrGRPCPermissionDenied = status.New(codes.PermissionDenied, "trusty: permission denied").Err() ErrGRPCInvalidArgument = status.New(codes.InvalidArgument, "trusty: invalid argument").Err() )
server-side error
var ( ErrTimeout = Error(ErrGRPCTimeout) ErrPermissionDenied = Error(ErrGRPCPermissionDenied) ErrInvalidArgument = Error(ErrGRPCInvalidArgument) )
client-side error
Functions ¶
Types ¶
type APIKey ¶
type APIKey struct { ID string `json:"id"` OrgID string `json:"org_id"` Key string `json:"key"` Enrollemnt bool `json:"enrollment"` Management bool `json:"management"` Billing bool `json:"billing"` CreatedAt time.Time `json:"created_at"` ExpiresAt time.Time `json:"expires_at"` UsedAt time.Time `json:"used_at"` }
APIKey provides API key
type ApproveOrgRequest ¶
type ApproveOrgRequest struct { Token string `json:"token"` Code string `json:"code"` // Action specifies action: approve|deny|info Action string `json:"action"` }
ApproveOrgRequest specifies a request to approve an organization
type AuthStsURLResponse ¶
type AuthStsURLResponse struct {
URL string `json:"url"`
}
AuthStsURLResponse provides response for AuthStsURLRequest
type AuthTokenRefreshResponse ¶
type AuthTokenRefreshResponse struct { Authorization *Authorization `json:"authorization"` Profile *UserInfo `json:"profile"` }
AuthTokenRefreshResponse provides response for token refresh request
type Authorization ¶
type Authorization struct { Version string `json:"version"` DeviceID string `json:"device_id"` UserID string `json:"user_id"` Login string `json:"login"` Name string `json:"name"` Email string `json:"email"` Role string `json:"role"` TokenType string `json:"token_type"` AccessToken string `json:"access_token"` ExpiresAt time.Time `json:"expires_at"` IssuedAt time.Time `json:"issued_at"` }
Authorization is returned to the client in token refresh response TODO: add refresh token
type CancelSubscriptionRequest ¶
type CancelSubscriptionRequest struct {
SubscriptionID string `json:"subscription_id"`
}
CancelSubscriptionRequest specifies cancel subscription request
type CancelSubscriptionResponse ¶
type CancelSubscriptionResponse struct {
SubscriptionID string `json:"subscription_id"`
}
CancelSubscriptionResponse specifies canceled subscription response
type Certificate ¶
type Certificate struct { // ID of the certificate ID string `json:"id,omitempty"` // OrgID of the certificate, only used with Org scope OrgID string `json:"org_id,omitempty"` // Skid provides Subject Key Identifier SKID string `json:"skid,omitempty"` // Ikid provides Issuer Key Identifier IKID string `json:"ikid,omitempty"` // SerialNumber provides Serial Number SerialNumber string `json:"serial_number,omitempty"` // NotBefore is the time when the validity period starts NotBefore time.Time `json:"not_before,omitempty"` // NotAfter is the time when the validity period starts NotAfter time.Time `json:"not_after,omitempty"` // Subject name Subject string `json:"subject,omitempty"` // Issuer name Issuer string `json:"issuer,omitempty"` // SHA256 thnumbprint of the cert Sha256 string `json:"sha256,omitempty"` // Profile of the certificate Profile string `json:"profile,omitempty"` // Pem encoded certificate Pem string `json:"pem,omitempty"` // IssuersPem provides PEM encoded issuers IssuersPem string `json:"issuers_pem,omitempty"` // Locations of the published Locations []string `json:"locations"` }
Certificate defines x509 certificate Certificate provides X509 Certificate information
type CertificatesResponse ¶
type CertificatesResponse struct {
Certificates []Certificate `json:"certificates"`
}
CertificatesResponse returns a list of certificates for the user
type CreateSubscriptionRequest ¶
type CreateSubscriptionRequest struct { OrgID string `json:"org_id"` ProductID string `json:"product_id"` }
CreateSubscriptionRequest specifies new subscription request
type CreateSubscriptionResponse ¶
type CreateSubscriptionResponse struct { Subscription Subscription `json:"subscription"` ClientSecret string `json:"client_secret"` }
CreateSubscriptionResponse specifies new subscription response client_secret can be used on client side to complete subscription if there are some further actions required by the customer. In the case of upfront payment (not trial) the payment is confirmed by passing the client_secret of the subscription's latest_invoice's payment_intent.
type DeleteOrgRequest ¶
type DeleteOrgRequest struct {
OrgID string `json:"org_id"`
}
DeleteOrgRequest specifies a request to delete organization
type FccContactResponse ¶
type FccContactResponse struct { FRN string `json:"frn"` RegistrationDate string `json:"registration_date"` LastUpdated string `json:"last_updated"` BusinessName string `json:"business_name"` BusinessType string `json:"business_type"` ContactOrganization string `json:"contact_organization"` ContactPosition string `json:"contact_position"` ContactName string `json:"contact_name"` ContactAddress string `json:"contact_address"` ContactEmail string `json:"contact_email"` ContactPhone string `json:"contact_phone"` ContactFax string `json:"contact_fax"` }
FccContactResponse provides response for https://apps.fcc.gov/coresWeb/searchDetail.do?frn=<fnr>
type FccFrnResponse ¶
type FccFrnResponse struct {
Filers []Filer `json:"filers"`
}
FccFrnResponse provides response for https://apps.fcc.gov/cgb/form499/499results.cfm?FilerID=<fillerID>&XML=TRUE&operational=1
type Filer ¶
type Filer struct { FilerID string `json:"filer_id"` FilerIDInfo FilerIDInfo `json:"filer_id_info"` }
Filer struct
type FilerIDInfo ¶
type FilerIDInfo struct { LegalName string `json:"legal_name"` FRN string `json:"frn"` HQAddress HQAdress `json:"hq_address"` CustomerInquiriesTelephone string `json:"customer_inquiries_telephone"` }
FilerIDInfo struct
type GetOrgAPIKeysResponse ¶
type GetOrgAPIKeysResponse struct {
Keys []APIKey `json:"keys"`
}
GetOrgAPIKeysResponse returns Orgs API keys
type GetOrgMembershipsResponse ¶
type GetOrgMembershipsResponse struct {
Memberships []*OrgMemberInfo `json:"memberships"`
}
GetOrgMembershipsResponse returns Orgs membership
type HQAdress ¶
type HQAdress struct { AddressLine string `json:"address_line"` City string `json:"city"` State string `json:"state"` ZipCode string `json:"zip_code"` }
HQAdress struct
type ListSubscriptionsResponse ¶
type ListSubscriptionsResponse struct {
Subscriptions []Subscription `json:"subscriptions"`
}
ListSubscriptionsResponse specifies list subscription response
type OpenCorporatesCompany ¶
type OpenCorporatesCompany struct { Name string `json:"name"` Kind string `json:"company_type"` Number string `json:"company_number"` CountryCode string `json:"country_code,omitempty"` Jurisdiction string `json:"jurisdiction_code,omitempty"` CreationDate time.Time `json:"incorporation_date"` Street string `json:"street_address"` City string `json:"locality"` Region string `json:"region,omitempty"` PostalCode string `json:"postal_code"` Country string `json:"country"` }
OpenCorporatesCompany represents a company.
type OrgMemberInfo ¶
type OrgMemberInfo struct { MembershipID string `json:"membership_id,omitempty"` OrgID string `json:"org_id"` OrgName string `json:"org_name"` UserID string `json:"user_id"` Role string `json:"role"` Name string `json:"name"` Email string `json:"email"` Source string `json:"source"` }
OrgMemberInfo provides Org membership information for a user
type OrgMemberRequest ¶
type OrgMemberRequest struct { // Action spacifies action: ADD|REMOVE Action string `json:"action"` UserID string `json:"user_id"` Email string `json:"email"` // Role is used in ADD action: admin|user Role string `json:"role"` }
OrgMemberRequest specify membership request
type OrgMembersResponse ¶
type OrgMembersResponse struct {
Members []*OrgMemberInfo `json:"members"`
}
OrgMembersResponse returns Orgs members
type OrgMembership ¶
type OrgMembership struct { ID string `json:"id"` OrgID string `json:"org_id"` OrgName string `json:"org_name"` UserID string `json:"user_id"` Role string `json:"role"` Source string `json:"source"` }
OrgMembership provides Org membership information for a user
type OrgResponse ¶
type OrgResponse struct {
Org Organization `json:"org"`
}
OrgResponse returns an organization
type Organization ¶
type Organization struct { ID string `json:"id"` ExternalID string `json:"extern_id,omitempty"` RegistrationID string `json:"registration_id,omitempty"` Provider string `json:"provider,omitempty"` Login string `json:"login"` AvatarURL string `json:"avatar_url,omitempty"` URL string `json:"html_url,omitempty"` Name string `json:"name"` Email string `json:"email"` BillingEmail string `json:"billing_email,omitempty"` Company string `json:"company,omitempty"` Location string `json:"location,omitempty"` Type string `json:"type,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Street string `json:"street_address,omitempty"` City string `json:"city,omitempty"` PostalCode string `json:"postal_code,omitempty"` Region string `json:"region,omitempty"` Country string `json:"country,omitempty"` Phone string `json:"phone,omitempty"` ApproverName string `json:"approver_name,omitempty"` ApproverEmail string `json:"approver_email,omitempty"` Status string `json:"status,omitempty"` ExpiresAt time.Time `json:"expires_at"` }
Organization represents an organization account.
type OrgsResponse ¶
type OrgsResponse struct {
Orgs []Organization `json:"orgs"`
}
OrgsResponse returns a list of organizations for the user
type Product ¶
type Product struct { // ID of the product ID string `json:"id"` // Name of the product Name string `json:"name"` // Price amount of the price Price uint64 `json:"price"` // Currency currency of the price Currency string `json:"currency"` // Years of the subscription Years uint64 `json:"years"` }
Product specifies product
type RegisterOrgRequest ¶
type RegisterOrgRequest struct {
FilerID string `json:"filer_id"`
}
RegisterOrgRequest specifies a request to register an organization
type RepositoriesResponse ¶
type RepositoriesResponse struct {
Repos []Repository `json:"repos"`
}
RepositoriesResponse returns a list of repositories for the user
type Repository ¶
type Repository struct { ID string `json:"id"` OrgID string `json:"org_id"` ExternalID string `json:"extern_id,omitempty"` Provider string `json:"provider,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` Name string `json:"name"` Email string `json:"email"` Company string `json:"company,omitempty"` Type string `json:"type,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Repository represents a repository.
type SearchOpenCorporatesResponse ¶
type SearchOpenCorporatesResponse struct {
Companies []OpenCorporatesCompany `json:"companies"`
}
SearchOpenCorporatesResponse provides response for PathForMartiniSearchCorps
type StripeWebhookResponse ¶
type StripeWebhookResponse struct { }
StripeWebhookResponse provides response to the Stripe webhook call
type Subscription ¶
type Subscription struct { OrgID string `json:"org_id"` Status string `json:"status"` CreatedAt time.Time `json:"created_at"` ExpiresAt time.Time `json:"expires_at"` Price uint64 `json:"price"` Currency string `json:"currency"` }
Subscription specifies subscription
type SubscriptionsProductsResponse ¶
type SubscriptionsProductsResponse struct { // Products list of products Products []Product `json:"products"` }
SubscriptionsProductsResponse specifies response when getting available products
type TrustyError ¶
type TrustyError struct {
// contains filtered or unexported fields
}
TrustyError defines gRPC server errors.
func (TrustyError) Error ¶
func (e TrustyError) Error() string
type UserInfo ¶
type UserInfo struct { ID string `json:"id"` ExternalID string `json:"extern_id"` Provider string `json:"provider"` Login string `json:"login"` Name string `json:"name"` Email string `json:"email"` Company string `json:"company,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` }
UserInfo provides basic info about user
type ValidateOrgRequest ¶
type ValidateOrgRequest struct {
OrgID string `json:"org_id"`
}
ValidateOrgRequest specifies a request to send validation to Approver
type ValidateOrgResponse ¶
type ValidateOrgResponse struct { Org Organization `json:"org"` Approver FccContactResponse `json:"approver"` Code string `json:"code"` }
ValidateOrgResponse provides a response for ValidateOrgRequest