Documentation ¶
Overview ¶
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func SetApidServices(s apid.Services, l apid.LogService)
- type ApiManager
- func (a *ApiManager) HandleApiProducts(w http.ResponseWriter, r *http.Request)
- func (a *ApiManager) HandleAppCredentials(w http.ResponseWriter, r *http.Request)
- func (a *ApiManager) HandleApps(w http.ResponseWriter, r *http.Request)
- func (a *ApiManager) HandleCompanies(w http.ResponseWriter, r *http.Request)
- func (a *ApiManager) HandleCompanyDevelopers(w http.ResponseWriter, r *http.Request)
- func (a *ApiManager) HandleDevelopers(w http.ResponseWriter, r *http.Request)
- func (a *ApiManager) InitAPI()
- type ApiManagerInterface
- type ApiProductDetails
- type ApiProductSuccessResponse
- type AppCredentialDetails
- type AppCredentialSuccessResponse
- type AppDetails
- type AppSuccessResponse
- type CompanyDetails
- type CompanyDeveloperDetails
- type CompanyDevelopersSuccessResponse
- type CompanySuccessResponse
- type ConsumerKeyStatusDetails
- type CredentialDetails
- type DbManager
- func (d *DbManager) GetApiProductNames(id string, idType string) ([]string, error)
- func (d *DbManager) GetApiProducts(org, priKey, priVal, secKey, secVal string) (apiProducts []common.ApiProduct, err error)
- func (d *DbManager) GetAppCredentials(org, priKey, priVal, secKey, secVal string) (appCredentials []common.AppCredential, err error)
- func (d *DbManager) GetAppNames(id string, t string) ([]string, error)
- func (d *DbManager) GetApps(org, priKey, priVal, secKey, secVal string) (apps []common.App, err error)
- func (d *DbManager) GetComNameByComId(comId string) (string, error)
- func (d *DbManager) GetComNames(id string, idType string) ([]string, error)
- func (d *DbManager) GetCompanies(org, priKey, priVal, secKey, secVal string) (companies []common.Company, err error)
- func (d *DbManager) GetCompanyDevelopers(org, priKey, priVal, secKey, secVal string) (companyDevelopers []common.CompanyDeveloper, err error)
- func (d *DbManager) GetDevEmailByDevId(devId string, org string) (string, error)
- func (d *DbManager) GetDevelopers(org, priKey, priVal, secKey, secVal string) (developers []common.Developer, err error)
- func (d *DbManager) GetStatus(id, t string) (string, error)
- type DbManagerInterface
- type DeveloperDetails
- type DeveloperSuccessResponse
Constants ¶
const ( AccessEntityPath = "/entities" EndpointApp = "/apps" EndpointApiProduct = "/apiproducts" EndpointCompany = "/companies" EndpointCompanyDeveloper = "/companydevelopers" EndpointDeveloper = "/developers" EndpointAppCredentials = "/appcredentials" )
const ( IdentifierAppId = "appid" IdentifierApiProductName = "apiproductname" IdentifierAppName = "appname" IdentifierApiResource = "apiresource" IdentifierDeveloperId = "developerid" IdentifierDeveloperEmail = "developeremail" IdentifierConsumerKey = "consumerkey" IdentifierCompanyName = "companyname" IdentifierOrganization = "organization" )
const ( TypeDeveloper = "developer" TypeCompany = "company" TypeApp = "app" TypeConsumerKey = "consumerkey" )
const ( AppTypeDeveloper = "DEVELOPER" AppTypeCompany = "COMPANY" )
const ( StatusApproved = "APPROVED" StatusRevoked = "REVOKED" StatusExpired = "EXPIRED" )
const ( INVALID_PARAMETERS = iota // Server DB Error DB_ERROR // Invalid/Wrong Data in DB data. This probably means something wrong happened in upstream PG/Transicator. DATA_ERROR // 404 NOT_FOUND // json Marshal Error JSON_MARSHAL_ERROR )
Variables ¶
var ( Identifiers = map[string]bool{ "appid": true, "apiproductname": true, "appname": true, "apiresource": true, "developerid": true, "companyname": true, "developeremail": true, "consumerkey": true, } ErrInvalidPar = &common.ErrorResponse{ ResponseCode: strconv.Itoa(INVALID_PARAMETERS), ResponseMessage: "Invalid Identifiers", StatusCode: http.StatusBadRequest, } ErrNotFound = &common.ErrorResponse{ ResponseCode: strconv.Itoa(NOT_FOUND), ResponseMessage: "Resource Not Found", StatusCode: http.StatusNotFound, } IdentifierTree = map[string]map[string][]string{ EndpointApiProduct: { IdentifierApiProductName: {}, IdentifierAppId: {IdentifierApiResource}, IdentifierAppName: {IdentifierApiResource, IdentifierDeveloperEmail, IdentifierDeveloperId, IdentifierCompanyName}, IdentifierConsumerKey: {IdentifierApiResource}, }, EndpointApp: { IdentifierAppId: {}, IdentifierAppName: {IdentifierDeveloperEmail, IdentifierDeveloperId, IdentifierCompanyName}, IdentifierConsumerKey: {}, }, EndpointCompany: { IdentifierAppId: {}, IdentifierCompanyName: {}, IdentifierConsumerKey: {}, }, EndpointCompanyDeveloper: { IdentifierCompanyName: {}, }, EndpointAppCredentials: { IdentifierConsumerKey: {}, }, EndpointDeveloper: { IdentifierDeveloperEmail: {}, IdentifierAppId: {}, IdentifierDeveloperId: {}, IdentifierConsumerKey: {}, }, } )
Functions ¶
func SetApidServices ¶
func SetApidServices(s apid.Services, l apid.LogService)
Types ¶
type ApiManager ¶
type ApiManager struct { DbMan DbManagerInterface AccessEntityPath string // contains filtered or unexported fields }
func (*ApiManager) HandleApiProducts ¶
func (a *ApiManager) HandleApiProducts(w http.ResponseWriter, r *http.Request)
func (*ApiManager) HandleAppCredentials ¶
func (a *ApiManager) HandleAppCredentials(w http.ResponseWriter, r *http.Request)
func (*ApiManager) HandleApps ¶
func (a *ApiManager) HandleApps(w http.ResponseWriter, r *http.Request)
func (*ApiManager) HandleCompanies ¶
func (a *ApiManager) HandleCompanies(w http.ResponseWriter, r *http.Request)
func (*ApiManager) HandleCompanyDevelopers ¶
func (a *ApiManager) HandleCompanyDevelopers(w http.ResponseWriter, r *http.Request)
func (*ApiManager) HandleDevelopers ¶
func (a *ApiManager) HandleDevelopers(w http.ResponseWriter, r *http.Request)
func (*ApiManager) InitAPI ¶
func (a *ApiManager) InitAPI()
type ApiManagerInterface ¶
type ApiManagerInterface interface { common.ApiManagerInterface HandleRequest(w http.ResponseWriter, r *http.Request) }
type ApiProductDetails ¶
type ApiProductDetails struct { // api proxies ApiProxies []string `json:"apiProxies"` // api resources ApiResources []string `json:"apiResources"` // approval type ApprovalType string `json:"approvalType"` // Attributes associated with the apiproduct. Attributes []common.Attribute `json:"attributes"` // ISO-8601 CreatedAt string `json:"createdAt"` // created by CreatedBy string `json:"createdBy"` // description Description string `json:"description"` // display name DisplayName string `json:"displayName"` // environments Environments []string `json:"environments"` // id ID string `json:"id"` // ISO-8601 LastModifiedAt string `json:"lastModifiedAt"` // last modified by LastModifiedBy string `json:"lastModifiedBy"` // name Name string `json:"name"` // quota interval QuotaInterval int64 `json:"quotaInterval"` // quota limit QuotaLimit int64 `json:"quotaLimit"` // quota time unit QuotaTimeUnit string `json:"quotaTimeUnit"` // scopes Scopes []string `json:"scopes"` }
type ApiProductSuccessResponse ¶
type ApiProductSuccessResponse struct { // api product ApiProduct *ApiProductDetails `json:"apiProduct"` // Organization Identifier/Name Organization string `json:"organization"` // primary identifier type PrimaryIdentifierType string `json:"primaryIdentifierType"` // primary identifier value PrimaryIdentifierValue string `json:"primaryIdentifierValue"` // secondary identifier type SecondaryIdentifierType string `json:"secondaryIdentifierType"` // secondary identifier value SecondaryIdentifierValue string `json:"secondaryIdentifierValue"` }
type AppCredentialDetails ¶
type AppCredentialDetails struct { // app Id AppID string `json:"appId"` // app name AppName string `json:"appName"` // Attributes associated with the app credential Attributes []common.Attribute `json:"attributes"` // consumer key ConsumerKey string `json:"consumerKey"` // consumer key status ConsumerKeyStatus *ConsumerKeyStatusDetails `json:"consumerKeyStatus"` // consumer secret ConsumerSecret string `json:"consumerSecret"` // developer Id DeveloperID string `json:"developerId"` // redirect uris RedirectUris []string `json:"redirectURIs"` // scopes Scopes []string `json:"scopes"` // status Status string `json:"status"` }
type ApiProductReferenceDetails struct { // status of the api product Status string `json:"status"` // name of the api product ApiProduct string `json:"apiProduct"` }
type AppCredentialSuccessResponse ¶
type AppCredentialSuccessResponse struct { // app credential AppCredential *AppCredentialDetails `json:"appCredential"` // Organization Identifier/Name Organization string `json:"organization"` // primary identifier type PrimaryIdentifierType string `json:"primaryIdentifierType"` // primary identifier value PrimaryIdentifierValue string `json:"primaryIdentifierValue"` }
type AppDetails ¶
type AppDetails struct { // access type AccessType string `json:"accessType"` // api products ApiProducts []string `json:"apiProducts"` // app credentials AppCredentials []*CredentialDetails `json:"appCredentials"` // app family AppFamily string `json:"appFamily"` // app parent, developer's Id or company's name AppParentID string `json:"appParentId"` // app parent status AppParentStatus string `json:"appParentStatus"` // Developer or Company AppType string `json:"appType"` // Attributes associated with the app. Attributes []common.Attribute `json:"attributes"` // callback Url CallbackUrl string `json:"callbackUrl"` // ISO-8601 CreatedAt string `json:"createdAt"` // created by CreatedBy string `json:"createdBy"` // display name DisplayName string `json:"displayName"` // id Id string `json:"id"` // ISO-8601 LastModifiedAt string `json:"lastModifiedAt"` // last modified by LastModifiedBy string `json:"lastModifiedBy"` // name Name string `json:"name"` // status Status string `json:"status"` }
type AppSuccessResponse ¶
type AppSuccessResponse struct { // app App *AppDetails `json:"app"` // Organization Identifier/Name Organization string `json:"organization"` // primary identifier type PrimaryIdentifierType string `json:"primaryIdentifierType"` // primary identifier value PrimaryIdentifierValue string `json:"primaryIdentifierValue"` // secondary identifier type SecondaryIdentifierType string `json:"secondaryIdentifierType"` // secondary identifier value SecondaryIdentifierValue string `json:"secondaryIdentifierValue"` }
type CompanyDetails ¶
type CompanyDetails struct { // apps Apps []string `json:"apps"` // Attributes associated with the company. Attributes []common.Attribute `json:"attributes"` // ISO-8601 CreatedAt string `json:"createdAt"` // created by CreatedBy string `json:"createdBy"` // display name DisplayName string `json:"displayName"` // id ID string `json:"id"` // ISO-8601 LastModifiedAt string `json:"lastModifiedAt"` // last modified by LastModifiedBy string `json:"lastModifiedBy"` // name Name string `json:"name"` // status Status string `json:"status"` }
type CompanyDeveloperDetails ¶
type CompanyDeveloperDetails struct { // company name CompanyName string `json:"companyName"` // ISO-8601 CreatedAt string `json:"createdAt"` // created by CreatedBy string `json:"createdBy"` // developer email DeveloperEmail string `json:"developerEmail"` // ISO-8601 LastModifiedAt string `json:"lastModifiedAt"` // last modified by LastModifiedBy string `json:"lastModifiedBy"` // roles Roles []string `json:"roles"` }
type CompanyDevelopersSuccessResponse ¶
type CompanyDevelopersSuccessResponse struct { // company developers CompanyDevelopers []*CompanyDeveloperDetails `json:"companyDevelopers"` // Organization Identifier/Name Organization string `json:"organization"` // primary identifier type PrimaryIdentifierType string `json:"primaryIdentifierType"` // primary identifier value PrimaryIdentifierValue string `json:"primaryIdentifierValue"` }
type CompanySuccessResponse ¶
type CompanySuccessResponse struct { // company Company *CompanyDetails `json:"company"` // Organization Identifier/Name Organization string `json:"organization"` // primary identifier type PrimaryIdentifierType string `json:"primaryIdentifierType"` // primary identifier value PrimaryIdentifierValue string `json:"primaryIdentifierValue"` }
type ConsumerKeyStatusDetails ¶
type ConsumerKeyStatusDetails struct { // app credential AppCredential *CredentialDetails `json:"appCredential"` // app Id AppID string `json:"appId"` // app name AppName string `json:"appName"` // app status AppStatus string `json:"appStatus"` // app type AppType string `json:"appType"` // developer Id DeveloperID string `json:"developerId"` // developer status DeveloperStatus string `json:"developerStatus"` // is valid key IsValidKey bool `json:"isValidKey"` }
type CredentialDetails ¶
type CredentialDetails struct { // api product references ApiProductReferences []string `json:"apiProductReferences"` // app Id AppID string `json:"appId"` // app status AppStatus string `json:"appStatus"` // Attributes associated with the client Id. Attributes []common.Attribute `json:"attributes"` // consumer key ConsumerKey string `json:"consumerKey"` // consumer secret ConsumerSecret string `json:"consumerSecret"` // expires at ExpiresAt string `json:"expiresAt"` // issued at IssuedAt string `json:"issuedAt"` // method type MethodType string `json:"methodType"` // scopes Scopes []string `json:"scopes"` // status Status string `json:"status"` }
type DbManager ¶
func (*DbManager) GetApiProductNames ¶
func (*DbManager) GetApiProducts ¶
func (d *DbManager) GetApiProducts(org, priKey, priVal, secKey, secVal string) (apiProducts []common.ApiProduct, err error)
func (*DbManager) GetAppCredentials ¶
func (d *DbManager) GetAppCredentials(org, priKey, priVal, secKey, secVal string) (appCredentials []common.AppCredential, err error)
func (*DbManager) GetAppNames ¶
func (*DbManager) GetComNameByComId ¶
func (*DbManager) GetComNames ¶
func (*DbManager) GetCompanies ¶
func (*DbManager) GetCompanyDevelopers ¶
func (d *DbManager) GetCompanyDevelopers(org, priKey, priVal, secKey, secVal string) (companyDevelopers []common.CompanyDeveloper, err error)
func (*DbManager) GetDevEmailByDevId ¶
func (*DbManager) GetDevelopers ¶
type DbManagerInterface ¶
type DbManagerInterface interface { common.DbManagerInterface GetApiProducts(org, priKey, priVal, secKey, secVal string) (apiProducts []common.ApiProduct, err error) GetApps(org, priKey, priVal, secKey, secVal string) (apps []common.App, err error) GetCompanies(org, priKey, priVal, secKey, secVal string) (companies []common.Company, err error) GetCompanyDevelopers(org, priKey, priVal, secKey, secVal string) (companyDevelopers []common.CompanyDeveloper, err error) GetAppCredentials(org, priKey, priVal, secKey, secVal string) (appCredentials []common.AppCredential, err error) GetDevelopers(org, priKey, priVal, secKey, secVal string) (developers []common.Developer, err error) // utils GetApiProductNames(id string, idType string) ([]string, error) GetAppNames(id string, idType string) ([]string, error) GetComNames(id string, idType string) ([]string, error) GetDevEmailByDevId(devId string, org string) (string, error) GetStatus(id, t string) (string, error) }
type DeveloperDetails ¶
type DeveloperDetails struct { // apps Apps []string `json:"apps"` // Attributes associated with the developer. Attributes []common.Attribute `json:"attributes"` // companies Companies []string `json:"companies"` // ISO-8601 CreatedAt string `json:"createdAt"` // created by CreatedBy string `json:"createdBy"` // email Email string `json:"email"` // first name FirstName string `json:"firstName"` // id ID string `json:"id"` // ISO-8601 LastModifiedAt string `json:"lastModifiedAt"` // last modified by LastModifiedBy string `json:"lastModifiedBy"` // last name LastName string `json:"lastName"` // password Password string `json:"password"` // status Status string `json:"status"` // user name UserName string `json:"userName"` }
type DeveloperSuccessResponse ¶
type DeveloperSuccessResponse struct { // developer Developer *DeveloperDetails `json:"developer"` // Organization Identifier/Name Organization string `json:"organization"` // primary identifier type PrimaryIdentifierType string `json:"primaryIdentifierType"` // primary identifier value PrimaryIdentifierValue string `json:"primaryIdentifierValue"` }