policystore

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

README

twirp-policystore-go

This repository contains autogenerated go Twirp stubs for the DECODE policystore component. These stubs have been generated automatically from the shared protobuf repo: https://github.com/thingful/decode-protorepo so these files should not be edited directly.

Making Changes

To make changes to the stubs, you must update the master protobuf definitions, regenerate the client stubs and push the updated versions to the appropriate repository. A script has been created within the master protorepo to automate this process.

Documentation

Overview

Package policystore is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.5.0.

It is generated from these files:

policystore.proto

Index

Constants

View Source
const PolicyStorePathPrefix = "/twirp/decode.iot.policystore.PolicyStore/"

PolicyStorePathPrefix is used for all URL paths on a twirp PolicyStore server. Requests are always: POST PolicyStorePathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.

Variables

View Source
var Operation_Action_name = map[int32]string{
	0: "UNKNOWN",
	1: "SHARE",
	2: "BIN",
	3: "MOVING_AVG",
}
View Source
var Operation_Action_value = map[string]int32{
	"UNKNOWN":    0,
	"SHARE":      1,
	"BIN":        2,
	"MOVING_AVG": 3,
}

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type CreateEntitlementPolicyRequest

type CreateEntitlementPolicyRequest struct {
	// This attribute is used to attach a human friendly label to the policy
	// suitable for presenting to the end user in the DECODE wallet. This is a
	// required field.
	Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"`
	// The list of operations we wish to create for the policy. This field is
	// required, and it is required that the client supplies at least one
	// Operation.
	Operations []*Operation `protobuf:"bytes,3,rep,name=operations,proto3" json:"operations,omitempty"`
	// This attribute contains an identifier of an authorizable attribute required
	// for taking part in the Coconut protocol.
	AuthorizableAttributeId string `` /* 132-byte string literal not displayed */
	// This attribute contains a reference to the credential issuer service the
	// end user must interact with in order to obtain blind credentials when
	// taking part in the Coconut protocol.
	CredentialIssuerEndpointUrl string `` /* 146-byte string literal not displayed */
	// Multi language description of the community for which this policy applies
	// consisting of a map where the map keys are a standard language code, and
	// the value is the description in that language.
	Descriptions         map[string]string `` /* 165-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

CreateEntitlementPolicyRequest is a message sent to the policy registration service to create a new entitlement policy. An entitlement policy is a collection of one or more "Operations". A single Operation specifies an functional transformation to be performed on a single data channel being published by a SmartCitizen device. The policy as a whole is comprised of one or more Operations.

func (*CreateEntitlementPolicyRequest) Descriptor

func (*CreateEntitlementPolicyRequest) Descriptor() ([]byte, []int)

func (*CreateEntitlementPolicyRequest) GetAuthorizableAttributeId added in v0.1.1

func (m *CreateEntitlementPolicyRequest) GetAuthorizableAttributeId() string

func (*CreateEntitlementPolicyRequest) GetCredentialIssuerEndpointUrl added in v0.1.1

func (m *CreateEntitlementPolicyRequest) GetCredentialIssuerEndpointUrl() string

func (*CreateEntitlementPolicyRequest) GetDescriptions added in v0.1.2

func (m *CreateEntitlementPolicyRequest) GetDescriptions() map[string]string

func (*CreateEntitlementPolicyRequest) GetLabel

func (m *CreateEntitlementPolicyRequest) GetLabel() string

func (*CreateEntitlementPolicyRequest) GetOperations

func (m *CreateEntitlementPolicyRequest) GetOperations() []*Operation

func (*CreateEntitlementPolicyRequest) ProtoMessage

func (*CreateEntitlementPolicyRequest) ProtoMessage()

func (*CreateEntitlementPolicyRequest) Reset

func (m *CreateEntitlementPolicyRequest) Reset()

func (*CreateEntitlementPolicyRequest) String

func (*CreateEntitlementPolicyRequest) XXX_DiscardUnknown

func (m *CreateEntitlementPolicyRequest) XXX_DiscardUnknown()

func (*CreateEntitlementPolicyRequest) XXX_Marshal

func (m *CreateEntitlementPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateEntitlementPolicyRequest) XXX_Merge

func (dst *CreateEntitlementPolicyRequest) XXX_Merge(src proto.Message)

func (*CreateEntitlementPolicyRequest) XXX_Size

func (m *CreateEntitlementPolicyRequest) XXX_Size() int

func (*CreateEntitlementPolicyRequest) XXX_Unmarshal

func (m *CreateEntitlementPolicyRequest) XXX_Unmarshal(b []byte) error

type CreateEntitlementPolicyResponse

type CreateEntitlementPolicyResponse struct {
	// This attribute contains a unique identifier for the community that can be
	// used for later requests to either join a community to a specific device, or
	// to delete the policy and so prevent new instances being applied to devices.
	CommunityId string `protobuf:"bytes,3,opt,name=community_id,json=communityId,proto3" json:"community_id,omitempty"`
	// This attribute contains a secret generated by the service that is
	// associated with the policy. This token is required to be presented by a
	// caller when deleting a policy, so must be treated as confidential by the
	// caller.
	Token                string   `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

CreateEntitlementPolicyResponse is a message returned by the service after a policy has been created. The message simply contains an identifier for the policy, as well as a token that the caller must protect.

func (*CreateEntitlementPolicyResponse) Descriptor

func (*CreateEntitlementPolicyResponse) Descriptor() ([]byte, []int)

func (*CreateEntitlementPolicyResponse) GetCommunityId added in v0.1.1

func (m *CreateEntitlementPolicyResponse) GetCommunityId() string

func (*CreateEntitlementPolicyResponse) GetToken

func (*CreateEntitlementPolicyResponse) ProtoMessage

func (*CreateEntitlementPolicyResponse) ProtoMessage()

func (*CreateEntitlementPolicyResponse) Reset

func (*CreateEntitlementPolicyResponse) String

func (*CreateEntitlementPolicyResponse) XXX_DiscardUnknown

func (m *CreateEntitlementPolicyResponse) XXX_DiscardUnknown()

func (*CreateEntitlementPolicyResponse) XXX_Marshal

func (m *CreateEntitlementPolicyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateEntitlementPolicyResponse) XXX_Merge

func (dst *CreateEntitlementPolicyResponse) XXX_Merge(src proto.Message)

func (*CreateEntitlementPolicyResponse) XXX_Size

func (m *CreateEntitlementPolicyResponse) XXX_Size() int

func (*CreateEntitlementPolicyResponse) XXX_Unmarshal

func (m *CreateEntitlementPolicyResponse) XXX_Unmarshal(b []byte) error

type DeleteEntitlementPolicyRequest

type DeleteEntitlementPolicyRequest struct {
	// This attribute contains the unique community identifier returned when
	// creating the policy. This is a required field.
	CommunityId string `protobuf:"bytes,3,opt,name=community_id,json=communityId,proto3" json:"community_id,omitempty"`
	// This attribute contains the token returned to the creator when they
	// created the policy, and must match the value stored within the
	// PolicyStore. This is a required field.
	Token                string   `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

DeleteEntitlementPolicyRequest is a message that can be sent to the registration service in order to delete an existing policy.

Deleting a policy does not affect any already existing streams configured for the policy, it just stops any new instances of this policy being applied to other devices.

func (*DeleteEntitlementPolicyRequest) Descriptor

func (*DeleteEntitlementPolicyRequest) Descriptor() ([]byte, []int)

func (*DeleteEntitlementPolicyRequest) GetCommunityId added in v0.1.1

func (m *DeleteEntitlementPolicyRequest) GetCommunityId() string

func (*DeleteEntitlementPolicyRequest) GetToken

func (m *DeleteEntitlementPolicyRequest) GetToken() string

func (*DeleteEntitlementPolicyRequest) ProtoMessage

func (*DeleteEntitlementPolicyRequest) ProtoMessage()

func (*DeleteEntitlementPolicyRequest) Reset

func (m *DeleteEntitlementPolicyRequest) Reset()

func (*DeleteEntitlementPolicyRequest) String

func (*DeleteEntitlementPolicyRequest) XXX_DiscardUnknown

func (m *DeleteEntitlementPolicyRequest) XXX_DiscardUnknown()

func (*DeleteEntitlementPolicyRequest) XXX_Marshal

func (m *DeleteEntitlementPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteEntitlementPolicyRequest) XXX_Merge

func (dst *DeleteEntitlementPolicyRequest) XXX_Merge(src proto.Message)

func (*DeleteEntitlementPolicyRequest) XXX_Size

func (m *DeleteEntitlementPolicyRequest) XXX_Size() int

func (*DeleteEntitlementPolicyRequest) XXX_Unmarshal

func (m *DeleteEntitlementPolicyRequest) XXX_Unmarshal(b []byte) error

type DeleteEntitlementPolicyResponse

type DeleteEntitlementPolicyResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

DeleteEntitlementPolicyResponse is a placeholder response returned from a delete request. Currently empty, but reserved for any fields identified for future iterations.

func (*DeleteEntitlementPolicyResponse) Descriptor

func (*DeleteEntitlementPolicyResponse) Descriptor() ([]byte, []int)

func (*DeleteEntitlementPolicyResponse) ProtoMessage

func (*DeleteEntitlementPolicyResponse) ProtoMessage()

func (*DeleteEntitlementPolicyResponse) Reset

func (*DeleteEntitlementPolicyResponse) String

func (*DeleteEntitlementPolicyResponse) XXX_DiscardUnknown

func (m *DeleteEntitlementPolicyResponse) XXX_DiscardUnknown()

func (*DeleteEntitlementPolicyResponse) XXX_Marshal

func (m *DeleteEntitlementPolicyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteEntitlementPolicyResponse) XXX_Merge

func (dst *DeleteEntitlementPolicyResponse) XXX_Merge(src proto.Message)

func (*DeleteEntitlementPolicyResponse) XXX_Size

func (m *DeleteEntitlementPolicyResponse) XXX_Size() int

func (*DeleteEntitlementPolicyResponse) XXX_Unmarshal

func (m *DeleteEntitlementPolicyResponse) XXX_Unmarshal(b []byte) error

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type ListEntitlementPoliciesRequest

type ListEntitlementPoliciesRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ListEntitlementPoliciesRequest is the message sent to the service in order to receive a list of currently defined entitlement policies. Currently this message is empty as we simply return a list of all known policies, but this message may be extended should a need be identified to paginate through policies, or apply any search or filtering techniques.

func (*ListEntitlementPoliciesRequest) Descriptor

func (*ListEntitlementPoliciesRequest) Descriptor() ([]byte, []int)

func (*ListEntitlementPoliciesRequest) ProtoMessage

func (*ListEntitlementPoliciesRequest) ProtoMessage()

func (*ListEntitlementPoliciesRequest) Reset

func (m *ListEntitlementPoliciesRequest) Reset()

func (*ListEntitlementPoliciesRequest) String

func (*ListEntitlementPoliciesRequest) XXX_DiscardUnknown

func (m *ListEntitlementPoliciesRequest) XXX_DiscardUnknown()

func (*ListEntitlementPoliciesRequest) XXX_Marshal

func (m *ListEntitlementPoliciesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListEntitlementPoliciesRequest) XXX_Merge

func (dst *ListEntitlementPoliciesRequest) XXX_Merge(src proto.Message)

func (*ListEntitlementPoliciesRequest) XXX_Size

func (m *ListEntitlementPoliciesRequest) XXX_Size() int

func (*ListEntitlementPoliciesRequest) XXX_Unmarshal

func (m *ListEntitlementPoliciesRequest) XXX_Unmarshal(b []byte) error

type ListEntitlementPoliciesResponse

type ListEntitlementPoliciesResponse struct {
	// This attribute contains the list of all policies currently available on
	// the device registration service.
	Policies             []*ListEntitlementPoliciesResponse_Policy `protobuf:"bytes,1,rep,name=policies,proto3" json:"policies,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                                  `json:"-"`
	XXX_unrecognized     []byte                                    `json:"-"`
	XXX_sizecache        int32                                     `json:"-"`
}

ListEntitlementPoliciesResponse is the response to the method call to list policies. It simply returns a list of all currently registered and non-deleted policies. This is intended to be able to be fed to the DECODE wallet in order to allow participant to choose which entitlements to apply to their devices.

func (*ListEntitlementPoliciesResponse) Descriptor

func (*ListEntitlementPoliciesResponse) Descriptor() ([]byte, []int)

func (*ListEntitlementPoliciesResponse) GetPolicies

func (*ListEntitlementPoliciesResponse) ProtoMessage

func (*ListEntitlementPoliciesResponse) ProtoMessage()

func (*ListEntitlementPoliciesResponse) Reset

func (*ListEntitlementPoliciesResponse) String

func (*ListEntitlementPoliciesResponse) XXX_DiscardUnknown

func (m *ListEntitlementPoliciesResponse) XXX_DiscardUnknown()

func (*ListEntitlementPoliciesResponse) XXX_Marshal

func (m *ListEntitlementPoliciesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListEntitlementPoliciesResponse) XXX_Merge

func (dst *ListEntitlementPoliciesResponse) XXX_Merge(src proto.Message)

func (*ListEntitlementPoliciesResponse) XXX_Size

func (m *ListEntitlementPoliciesResponse) XXX_Size() int

func (*ListEntitlementPoliciesResponse) XXX_Unmarshal

func (m *ListEntitlementPoliciesResponse) XXX_Unmarshal(b []byte) error

type ListEntitlementPoliciesResponse_Policy

type ListEntitlementPoliciesResponse_Policy struct {
	// This attribute contains the unique identifier of the policy.
	CommunityId string `protobuf:"bytes,7,opt,name=community_id,json=communityId,proto3" json:"community_id,omitempty"`
	// This attribute contains a human friendly label describing the policy
	// suitable for rendering in the DECODE wallet
	Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"`
	// This field contains a list of the operations that define the policy.
	Operations []*Operation `protobuf:"bytes,3,rep,name=operations,proto3" json:"operations,omitempty"`
	// This attribute contains the public key of the policy. This public key
	// attribute is the label applied to the bucket within the datastore which
	// will be how data can be downloaded for the entitlement policy.
	PublicKey string `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// This attribute contains an identifier of an authorizable attribute required
	// for taking part in the Coconut protocol.
	AuthorizableAttributeId string `` /* 132-byte string literal not displayed */
	// This attribute contains a reference to the credential issuer service the
	// end user must interact with in order to obtain blind credentials when
	// taking part in the Coconut protocol.
	CredentialIssuerEndpointUrl string `` /* 146-byte string literal not displayed */
	// Multi language description of the community for which this policy applies
	// consisting of a map where the map keys are a standard language code, and
	// the value is the description in that language.
	Descriptions         map[string]string `` /* 165-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

Policy is a nested type used to be able to cleanly return a list of Policies within a single response. Each Policy instance contains the id of the policy, the list of entitlements defined by the policy, as well as the policy's public key.

func (*ListEntitlementPoliciesResponse_Policy) Descriptor

func (*ListEntitlementPoliciesResponse_Policy) Descriptor() ([]byte, []int)

func (*ListEntitlementPoliciesResponse_Policy) GetAuthorizableAttributeId added in v0.1.1

func (m *ListEntitlementPoliciesResponse_Policy) GetAuthorizableAttributeId() string

func (*ListEntitlementPoliciesResponse_Policy) GetCommunityId added in v0.1.1

func (m *ListEntitlementPoliciesResponse_Policy) GetCommunityId() string

func (*ListEntitlementPoliciesResponse_Policy) GetCredentialIssuerEndpointUrl added in v0.1.1

func (m *ListEntitlementPoliciesResponse_Policy) GetCredentialIssuerEndpointUrl() string

func (*ListEntitlementPoliciesResponse_Policy) GetDescriptions added in v0.1.2

func (m *ListEntitlementPoliciesResponse_Policy) GetDescriptions() map[string]string

func (*ListEntitlementPoliciesResponse_Policy) GetLabel

func (*ListEntitlementPoliciesResponse_Policy) GetOperations

func (m *ListEntitlementPoliciesResponse_Policy) GetOperations() []*Operation

func (*ListEntitlementPoliciesResponse_Policy) GetPublicKey

func (*ListEntitlementPoliciesResponse_Policy) ProtoMessage

func (*ListEntitlementPoliciesResponse_Policy) Reset

func (*ListEntitlementPoliciesResponse_Policy) String

func (*ListEntitlementPoliciesResponse_Policy) XXX_DiscardUnknown

func (m *ListEntitlementPoliciesResponse_Policy) XXX_DiscardUnknown()

func (*ListEntitlementPoliciesResponse_Policy) XXX_Marshal

func (m *ListEntitlementPoliciesResponse_Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListEntitlementPoliciesResponse_Policy) XXX_Merge

func (*ListEntitlementPoliciesResponse_Policy) XXX_Size

func (*ListEntitlementPoliciesResponse_Policy) XXX_Unmarshal

func (m *ListEntitlementPoliciesResponse_Policy) XXX_Unmarshal(b []byte) error

type Operation

type Operation struct {
	// The unique id of the sensor type for which this specific entitlement is
	// defined. This is a required field.
	SensorId uint32 `protobuf:"varint,1,opt,name=sensor_id,json=sensorId,proto3" json:"sensor_id,omitempty"`
	// The specific action this operation defines for the sensor type. This is a
	// required field.
	Action Operation_Action `protobuf:"varint,2,opt,name=action,proto3,enum=decode.iot.policystore.Operation_Action" json:"action,omitempty"`
	// The bins attribute is used to specify the the bins into which incoming
	// values should be classified. Each element in the list is the upper
	// inclusive bound of a bin. The values submitted must be sorted in strictly
	// increasing order. There is no need to add a highest bin with +Inf bound, it
	// will be added implicitly. This field is optional unless an Action of `BIN`
	// has been requested, in which case it is required. It is an error to send
	// values for this attribute unless the value of Action is `BIN`.
	Bins []float64 `protobuf:"fixed64,3,rep,packed,name=bins,proto3" json:"bins,omitempty"`
	// This attribute is used to control the entitlement in the case for which we
	// have specified an action type representing a moving average. It represents
	// the interval in seconds over which the moving average should be calculated,
	// e.g. for a 15 minute moving average the value supplied here would be 900.
	// This field is optional unless an Action of `MOVING_AVG` has been specified,
	// in which case it is required. It is an error to send a value for this
	// attribute unless the value of Action is `MOVING_AVG`.
	Interval             uint32   `protobuf:"varint,4,opt,name=interval,proto3" json:"interval,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Operation is a message used to describe an operation that may be applied to a specific data type published by a SmartCitizen device. The message contains two required fields: the sensor_id (this is the type of data we are entitling over), and a specified operation to be performed on that sensor type. This can be one of three actions: to share the sensor without modification, to apply a binning algorithm to the data so we output a bucketed value, or a moving average calculated dynamically for incoming values.

If an operation specifies an Action type of `BIN`, then the optional `buckets` parameter is required, similarly if an action type of `MOVING_AVG` is specified, then `interval` is a required field.

func (*Operation) Descriptor

func (*Operation) Descriptor() ([]byte, []int)

func (*Operation) GetAction

func (m *Operation) GetAction() Operation_Action

func (*Operation) GetBins

func (m *Operation) GetBins() []float64

func (*Operation) GetInterval

func (m *Operation) GetInterval() uint32

func (*Operation) GetSensorId

func (m *Operation) GetSensorId() uint32

func (*Operation) ProtoMessage

func (*Operation) ProtoMessage()

func (*Operation) Reset

func (m *Operation) Reset()

func (*Operation) String

func (m *Operation) String() string

func (*Operation) XXX_DiscardUnknown

func (m *Operation) XXX_DiscardUnknown()

func (*Operation) XXX_Marshal

func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Operation) XXX_Merge

func (dst *Operation) XXX_Merge(src proto.Message)

func (*Operation) XXX_Size

func (m *Operation) XXX_Size() int

func (*Operation) XXX_Unmarshal

func (m *Operation) XXX_Unmarshal(b []byte) error

type Operation_Action

type Operation_Action int32

An enumeration which allows us to specify what type of sharing is to be defined for the specified sensor type. The default value is `SHARE` which implies sharing the data at full resolution. If this type is specified, it is an error if either of `buckets` or `interval` is also supplied.

const (
	Operation_UNKNOWN    Operation_Action = 0
	Operation_SHARE      Operation_Action = 1
	Operation_BIN        Operation_Action = 2
	Operation_MOVING_AVG Operation_Action = 3
)

func (Operation_Action) EnumDescriptor

func (Operation_Action) EnumDescriptor() ([]byte, []int)

func (Operation_Action) String

func (x Operation_Action) String() string

type PolicyStore

type PolicyStore interface {
	// CreateEntitlementPolicy is a method exposed by the service which allows a
	// new entitlement policy to be created and stored within the device
	// registration service. Once a policy has been created, users will then be
	// able to apply this policy to their devices via the wallet.
	CreateEntitlementPolicy(context.Context, *CreateEntitlementPolicyRequest) (*CreateEntitlementPolicyResponse, error)

	// DeleteEntitlementPolicy is a method exposed by the service which allows an
	// authorized client to request that an entitlement policy be deleted.
	// Deleting a policy will not affect any existing devices that have already
	// used the policy in order to create one or more streams within the encoder,
	// however it will prevent any new applications of that policy to other
	// devices.
	DeleteEntitlementPolicy(context.Context, *DeleteEntitlementPolicyRequest) (*DeleteEntitlementPolicyResponse, error)

	// ListEntitlementPolicies is a method exposed by the service which returns a
	// list of all policies currently defined and available within the service to
	// be applied to devices. Currently it just returns a list of all known
	// policies with no capability to filter or paginate these policies.
	ListEntitlementPolicies(context.Context, *ListEntitlementPoliciesRequest) (*ListEntitlementPoliciesResponse, error)
}

PolicyStore is a component that is responsible for maintaining a list of currently active data policies that are in use within the DECODE IoT pilot. It exposes an API by which clients can create or delete policies from the system, and importantly it exposes an API by which the DECODE wallet can retrieve a list of active policies which allows the wallet to then present a UI to the end user by which they will be able to choose which policies they wish to take part in.

func NewPolicyStoreJSONClient

func NewPolicyStoreJSONClient(addr string, client HTTPClient) PolicyStore

NewPolicyStoreJSONClient creates a JSON client that implements the PolicyStore interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewPolicyStoreProtobufClient

func NewPolicyStoreProtobufClient(addr string, client HTTPClient) PolicyStore

NewPolicyStoreProtobufClient creates a Protobuf client that implements the PolicyStore interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type TwirpServer

type TwirpServer interface {
	http.Handler
	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)
	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewPolicyStoreServer

func NewPolicyStoreServer(svc PolicyStore, hooks *twirp.ServerHooks) TwirpServer

Jump to

Keyboard shortcuts

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