gongsi

package
v0.0.0-...-8dae094 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2016 License: MIT Imports: 4 Imported by: 0

README

Gongsi

NGSI utilities for Orion in Go. Low level API to do NGSI queries to an Orion Context Broker plus a command-line utility to test such queries.

ngsi command-line utility

You can use the command-line utility in the ngsi folder.

To query an entity do:

	ngsi query <entityID>

or

	ngsi q <entity>

To query a specific attribute do:

	ngsi query <entityID> <attributeID>

or

	ngsi q <entity> <attributeID>

TODO

  • Queries

    • Types
  • Updates

  • Subscriptions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextAttribute

type ContextAttribute struct {
	Name      string            `json:"name"`
	Type      string            `json:"type,omitempty"`
	Value     string            `json:"value"`
	Metadatas []ContextMetadata `json:"metadatas,omitempty"`
}

type ContextElement

type ContextElement struct {
	Id                  string             `json:"id"`
	Type                string             `json:"type,omitempty"`
	IsPattern           interface{}        `json:"isPattern"`
	AttributeDomainName string             `json:"attributeDomainName,omitempty"`
	Attributes          []ContextAttribute `json:"attributes,omitempty"`
	Metadatas           []ContextMetadata  `json:"metadatas,omitempty"`
}

type ContextElementResponse

type ContextElementResponse struct {
	ContextElement ContextElement `json:"contextElement"`
	StatusCode     StatusCode     `json:"statusCode"`
}

type ContextMetadata

type ContextMetadata struct {
	Name  string `json:"name"`
	Type  string `json:"type,omitempty"`
	Value string `json:"value"`
}

type ContextRegistration

type ContextRegistration struct {
	EntityIdList                  []EntityId                     `json:"EntityIdList,omitempty"`
	ContextRegistrationAttributes []ContextRegistrationAttribute `json:"ContextRegistrationAttributes,omitempty"`
	Metadatas                     []ContextMetadata              `json:"metadatas,omitempty"`
	ProvidingApplication          string                         `json:"ProvidingApplication"`
}

type ContextRegistrationAttribute

type ContextRegistrationAttribute struct {
	Name      string            `json:"name"`
	Type      string            `json:"type,omitempty"`
	IsDomain  bool              `json:"isDomain"`
	Metadatas []ContextMetadata `json:"metadatas,omitempty"`
}

type ContextRegistrationResponse

type ContextRegistrationResponse struct {
	ContextRegistration ContextRegistration `json:"contextRegistration"`
	ErrorCode           StatusCode          `json:"errorCode"`
}

type ConvertibleBoolean

type ConvertibleBoolean bool

func (ConvertibleBoolean) UnmarshalJSON

func (bit ConvertibleBoolean) UnmarshalJSON(data []byte) error

type DiscoverContextAvailabilityRequest

type DiscoverContextAvailabilityRequest struct {
	Entities    []EntityId         `json:"entities"`
	Attributes  []ContextAttribute `json:"attributes,omitempty"`
	Restriction Restriction        `json:"restriction,omitempty"`
}

type DiscoverContextAvailabilityResponse

type DiscoverContextAvailabilityResponse struct {
	ContextRegistrationResponses []ContextRegistrationResponse `json:"contextRegistrationResponses,omitempty"`
	ErrorCode                    StatusCode                    `json:"errorCode,omitempty"`
}

type EntityId

type EntityId struct {
	Name      string `json:"name"`
	Type      string `json:"type,omitempty"`
	IsPattern bool   `json:"isPattern"`
}

type Gongsi

type Gongsi struct {
	Host     string
	Port     int
	Encoding string
	// contains filtered or unexported fields
}

func (*Gongsi) ConvQueryContext

func (g *Gongsi) ConvQueryContext(eid string) (string, error)

func (*Gongsi) ConvQueryContextAttribute

func (g *Gongsi) ConvQueryContextAttribute(entity, attribute string) (string, error)

func (*Gongsi) Init

func (g *Gongsi) Init()

func (*Gongsi) QueryContext

func (g *Gongsi) QueryContext(elem ContextElement) (string, error)

func (*Gongsi) SetSSL

func (g *Gongsi) SetSSL(useSSL bool)

func (*Gongsi) UpdateContext

func (g *Gongsi) UpdateContext(elem ContextElement) (string, error)

func (*Gongsi) Version

func (g *Gongsi) Version() (string, error)

type NotifyCondition

type NotifyCondition struct {
	Type NotifyConditionType `json:"name"`
	// CondValues  []ValueList         `json:"condValues,omitempty"`
	Restriction string `json:"restriction,omitempty"`
}

type NotifyConditionType

type NotifyConditionType int
const (
	ONTIMEINTERVAL NotifyConditionType = 1
	ONVALUE
	ONCHANGE
)

type NotifyContextAvailabilityRequest

type NotifyContextAvailabilityRequest struct {
	SubscriptionId       string                `json:"subscriptionId"`
	ContextRegistrations []ContextRegistration `json:"contextRegistrations,omitempty"`
	ErrorCode            StatusCode            `json:"errorCode,omitempty"`
}

type NotifyContextAvailabilityResponse

type NotifyContextAvailabilityResponse struct {
	ResponseCode StatusCode `json:"responseCode"`
}

type NotifyContextRequest

type NotifyContextRequest struct {
	SubscriptionId   string                   `json:"subscriptionId"`
	Originator       string                   `json:"originator"`
	Restriction      Restriction              `json:"restriction,omitempty"`
	ContextResponses []ContextElementResponse `json:"contextResponses,omitempty"`
}

type NotifyContextResponse

type NotifyContextResponse struct {
	ResponseCode StatusCode `json:"responseCode"`
}

type OperationScope

type OperationScope struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type QueryContextRequest

type QueryContextRequest struct {
	Entities    []ContextElement `json:"entities"`
	Attributes  []string         `json:"attributes,omitempty"`
	Restriction Restriction      `json:"restriction,omitempty"`
}

type QueryContextResponse

type QueryContextResponse struct {
	ContextResponses []ContextElementResponse `json:"contextResponses,omitempty"`
	ErrorCode        StatusCode               `json:"errorCode,omitempty"`
}

type RegisterContextRequest

type RegisterContextRequest struct {
	ContextRegistrations []ContextRegistration `json:"contextRegistrations,omitempty"`
	Duration             string                `json:"duration,omitempty"`
	RegistrationId       string                `json:"registrationId,omitempty"`
}

type RegisterContextResponse

type RegisterContextResponse struct {
	Duration       string     `json:"duration,omitempty"`
	RegistrationId string     `json:"registrationId"`
	ErrorCode      StatusCode `json:"errorCode,omitempty"`
}

type Restriction

type Restriction struct {
	AttributeExpression string           `json:"attributeExpression"`
	Scope               []OperationScope `json:"scope,omitempty"`
}

type StatusCode

type StatusCode struct {
	Code         int    `json:"name"`
	ReasonPhrase string `json:"type,omitempty"`
	Details      string `json:"details,omitempty"`
}

type SubscribeContextAvailabilityRequest

type SubscribeContextAvailabilityRequest struct {
	Entities       []EntityId         `json:"entities"`
	Attributes     []ContextAttribute `json:"attributes,omitempty"`
	Reference      string             `json:"reference"`
	Duration       string             `json:"duration,omitempty"`
	Restriction    Restriction        `json:"restriction,omitempty"`
	SubscriptionId string             `json:"subscriptionId,omitempty"`
}

type SubscribeContextAvailabilityResponse

type SubscribeContextAvailabilityResponse struct {
	SubscriptionId string     `json:"subscriptionId"`
	Duration       string     `json:"duration,omitempty"`
	ErrorCode      StatusCode `json:"errorCode,omitempty"`
}

type SubscribeContextRequest

type SubscribeContextRequest struct {
	Entities         []EntityId         `json:"entities"`
	Attributes       []ContextAttribute `json:"attributes,omitempty"`
	Reference        string             `json:"reference"`
	Duration         string             `json:"duration,omitempty"`
	Restriction      Restriction        `json:"restriction,omitempty"`
	NotifyConditions []NotifyCondition  `json:"notifyConditions,omitempty"`
	Throttling       string             `json:"throttling,omitempty"`
}

type SubscribeContextResponse

type SubscribeContextResponse struct {
	SubscribeResponse `json:"subscribeResponse,omitempty"`
	SubscribeError    `json:"subscribeError,omitempty"`
}

type SubscribeError

type SubscribeError struct {
	SubscriptionId string `json:"subscriptionId,omitempty"`
	ErrorCode      string `json:"errorCode"`
}

type SubscribeResponse

type SubscribeResponse struct {
	SubscriptionId string `json:"subscriptionId"`
	Duration       string `json:"duration,omitempty"`
	Throttling     string `json:"throttling,omitempty"`
}

type UnsubscribeContextAvailabilityRequest

type UnsubscribeContextAvailabilityRequest struct {
	SubscriptionId string `json:"subscriptionId"`
}

type UnsubscribeContextAvailabilityResponse

type UnsubscribeContextAvailabilityResponse struct {
	SubscriptionId string     `json:"subscriptionId"`
	StatusCode     StatusCode `json:"statusCode"`
}

type UnsubscribeContextRequest

type UnsubscribeContextRequest struct {
	SubscriptionId string `json:"subscriptionId"`
}

type UnsubscribeContextResponse

type UnsubscribeContextResponse struct {
	SubscriptionId string     `json:"subscriptionId"`
	StatusCode     StatusCode `json:"statusCode"`
}

type UpdateActionType

type UpdateActionType int
const (
	UPDATE UpdateActionType = 1
	APPEND
	DELETE
)

type UpdateContextAvailabilitySubscriptionRequest

type UpdateContextAvailabilitySubscriptionRequest struct {
	Entities       []EntityId         `json:"entities"`
	Attributes     []ContextAttribute `json:"attributes,omitempty"`
	Duration       string             `json:"duration,omitempty"`
	Restriction    Restriction        `json:"restriction,omitempty"`
	SubscriptionId string             `json:"subscriptionId,omitempty"`
}

type UpdateContextAvailabilitySubscriptionResponse

type UpdateContextAvailabilitySubscriptionResponse struct {
	SubscriptionId string     `json:"subscriptionId"`
	Duration       string     `json:"duration,omitempty"`
	ErrorCode      StatusCode `json:"errorCode,omitempty"`
}

type UpdateContextRequest

type UpdateContextRequest struct {
	ContextElements []ContextElement `json:"contextElements"`
	UpdateAction    string           `json:"updateAction"`
}

type UpdateContextResponse

type UpdateContextResponse struct {
	ContextResponses []ContextElementResponse `json:"contextResponses"`
	ErrorCode        StatusCode               `json:"errorCode,omitempty"`
}

type UpdateContextSubscriptionRequest

type UpdateContextSubscriptionRequest struct {
	SubscriptionId   string            `json:"subscriptionId"`
	Duration         string            `json:"duration,omitempty"`
	Restriction      Restriction       `json:"restriction,omitempty"`
	NotifyConditions []NotifyCondition `json:"notifyConditions,omitempty"`
	Throttling       string            `json:"throttling,omitempty"`
}

type UpdateContextSubscriptionResponse

type UpdateContextSubscriptionResponse struct {
	SubscribeResponse `json:"subscribeResponse,omitempty"`
	SubscribeError    `json:"subscribeError,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL