schema

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Overview

ResourceLink provides a link for retrieving details for its resource types: https://github.com/openconnectivityfoundation/core/blob/OCF-v2.0.0/schemas/oic.oic-link-schema.json

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitMask

type BitMask uint8

BitMask is defined with Policy on the line 1822 of the Core specification.

const (
	Discoverable BitMask = 1 << iota
	Observable
)

BitMask is defined with Policy on the line 1822 of the Core specification.

func (BitMask) Has

func (b BitMask) Has(flag BitMask) bool

Has returns true if the flag is set.

type Endpoint

type Endpoint struct {
	URI      string `json:"ep"`
	Priority uint64 `json:"pri"`
}

Endpoint is defined on the line 2439 and 1892, Priority on 2434 of the Core specification: - https://openconnectivity.org/specs/OCF_Core_Specification_v2.0.0.pdf - https://github.com/openconnectivityfoundation/core/blob/OCF-v2.0.0/schemas/oic.oic-link-schema.json When there are multiple endpoints, Priority indicates the priority among them. The lower the value, the higher the priority.

func (Endpoint) GetAddr

func (ep Endpoint) GetAddr() (kitNet.Addr, error)

GetAddr parses a endpoint URI to addr.

type Endpoints

type Endpoints []Endpoint

func (Endpoints) FilterSecureEndpoints

func (r Endpoints) FilterSecureEndpoints() Endpoints

FilterSecureEndpoints returns secure endpoints in order of priority.

func (Endpoints) FilterUnsecureEndpoints

func (r Endpoints) FilterUnsecureEndpoints() Endpoints

FilterUnsecureEndpoints returns unsecure endpoints in order of priority.

func (Endpoints) GetAddr

func (r Endpoints) GetAddr(scheme Scheme) (kitNet.Addr, error)

func (Endpoints) Sort

func (r Endpoints) Sort() Endpoints

Sort sorts in order priority

type Policy

type Policy struct {
	BitMask    BitMask `json:"bm"`
	UDPPort    uint16  `json:"port"`
	TCPPort    uint16  `json:"x.org.iotivity.tcp"`
	TCPTLSPort uint16  `json:"x.org.iotivity.tls"`

	// Secured is true if the resource is only available via an encrypted connection.
	Secured bool `json:"sec"`
}

Policy is defined on the line 1822 of the Core specification: https://openconnectivity.org/specs/OCF_Core_Specification_v2.0.0.pdf

type ResourceLink struct {
	ID                    string    `json:"id,omitempty"`
	Href                  string    `json:"href"`
	ResourceTypes         []string  `json:"rt,omitempty"`
	Interfaces            []string  `json:"if,omitempty"`
	Policy                *Policy   `json:"p,omitempty"`
	Endpoints             Endpoints `json:"eps,omitempty"`
	Anchor                string    `json:"anchor,omitempty"`
	DeviceID              string    `json:"di,omitempty"`
	InstanceID            int64     `json:"ins,omitempty"`
	Title                 string    `json:"title,omitempty"`
	SupportedContentTypes []string  `json:"type,omitempty"`
}

func (ResourceLink) GetDeviceID

func (r ResourceLink) GetDeviceID() string

GetDeviceID returns device id.

func (ResourceLink) GetEndpoints

func (d ResourceLink) GetEndpoints() Endpoints

GetEndpoints returns endpoints in order of priority.

func (ResourceLink) GetSecureEndpoints

func (d ResourceLink) GetSecureEndpoints() Endpoints

func (ResourceLink) GetTCPAddr

func (r ResourceLink) GetTCPAddr() (_ kitNet.Addr, err error)

GetTCPAddr parses and finds a TCP endpoint address.

func (ResourceLink) GetTCPSecureAddr

func (r ResourceLink) GetTCPSecureAddr() (_ kitNet.Addr, err error)

GetTCPSecureAddr parses and finds a TCP secure endpoint address.

func (ResourceLink) GetUDPAddr

func (r ResourceLink) GetUDPAddr() (_ kitNet.Addr, err error)

GetUDPAddr parses and finds a UDP endpoint address.

func (ResourceLink) GetUDPSecureAddr

func (r ResourceLink) GetUDPSecureAddr() (_ kitNet.Addr, err error)

GetUDPSecureAddr parses and finds a UDP endpoint address.

func (ResourceLink) GetUnsecureEndpoints

func (d ResourceLink) GetUnsecureEndpoints() Endpoints

func (ResourceLink) HasType

func (r ResourceLink) HasType(resourceType string) bool

HasType checks the resource type.

func (ResourceLink) PatchEndpoint

func (r ResourceLink) PatchEndpoint(addr kitNet.Addr, deviceEndpoints Endpoints) ResourceLink

PatchEndpoint adds Endpoint information where missing.

type ResourceLinks []ResourceLink

func (ResourceLinks) GetResourceHrefs

func (d ResourceLinks) GetResourceHrefs(resourceTypes ...string) []string

GetResourceHrefs resolves URIs for a resource type.

func (d ResourceLinks) GetResourceLink(href string) (_ ResourceLink, ok bool)

GetResourceLink finds a resource link with the same href.

func (d ResourceLinks) GetResourceLinks(resourceTypes ...string) ResourceLinks

GetResourceLinks resolves URIs for a resource type.

func (ResourceLinks) Len

func (a ResourceLinks) Len() int

func (ResourceLinks) Less

func (a ResourceLinks) Less(i, j int) bool

func (ResourceLinks) PatchEndpoint

func (d ResourceLinks) PatchEndpoint(addr kitNet.Addr, deviceEndpoints Endpoints) ResourceLinks

PatchEndpoint adds Endpoint information where missing.

func (ResourceLinks) Sort

func (a ResourceLinks) Sort() ResourceLinks

func (ResourceLinks) Swap

func (a ResourceLinks) Swap(i, j int)

type Scheme

type Scheme string
const (
	TCPSecureScheme Scheme = "coaps+tcp"
	TCPScheme       Scheme = "coap+tcp"
	UDPScheme       Scheme = "coap"
	UDPSecureScheme Scheme = "coaps"
)

Directories

Path Synopsis
Account Token https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.account.swagger.json
Account Token https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.account.swagger.json
Access Control List https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.acl2.swagger.json
Access Control List https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.acl2.swagger.json
Auditable Event List https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.ael.swagger.json
Auditable Event List https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.ael.swagger.json
Package cloud implements Cloud Configuration Resource.
Package cloud implements Cloud Configuration Resource.
Collection https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.col.swagger.json
Collection https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.col.swagger.json
Device Configuration https://github.com/openconnectivityfoundation/core-extensions/blob/master/swagger2.0/oic.wk.con.swagger.json
Device Configuration https://github.com/openconnectivityfoundation/core-extensions/blob/master/swagger2.0/oic.wk.con.swagger.json
Credential https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.cred.swagger.json
Credential https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.cred.swagger.json
Certificate Signing Request https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.csr.swagger.json
Certificate Signing Request https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.csr.swagger.json
Device info.
Device info.
Device Owner Transfer Method https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.doxm.swagger.json
Device Owner Transfer Method https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.doxm.swagger.json
Introspection Resource https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.introspection.swagger.json
Introspection Resource https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.introspection.swagger.json
Platform info https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.p.swagger.json
Platform info https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.p.swagger.json
Package pstat implements Device Provisioning Status resource.
Package pstat implements Device Provisioning Status resource.
Discoverable Resources https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.res.swagger.json
Discoverable Resources https://github.com/openconnectivityfoundation/core/blob/master/swagger2.0/oic.wk.res.swagger.json
Asserted Roles https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.roles.swagger.json
Asserted Roles https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.roles.swagger.json
Security Domain Information https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.sdi.swagger.json
Security Domain Information https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.sdi.swagger.json
Session Resource that manages the persistent session between a Device and OCF Cloud.
Session Resource that manages the persistent session between a Device and OCF Cloud.
Security Profile https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.sp.swagger.json
Security Profile https://github.com/openconnectivityfoundation/security/blob/master/swagger2.0/oic.sec.sp.swagger.json

Jump to

Keyboard shortcuts

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