soracom

package module
v0.0.0-...-505fc9e Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2016 License: MIT Imports: 10 Imported by: 0

README

SORACOM SDK for Go

SORACOM SDK for Go は、株式会社ソラコムの提供する IoT プラットフォーム SORACOM の API を Go のプログラムから呼び出すためのパッケージです。

SORACOM SDK for Go はまだベータ版です。不足している機能はまだたくさんありますし、実装されている機能にも不具合があるかもしれません。また現在提供している機能が予告なく変更されたり削除されたりする可能性もあります。 問題の報告や機能の要望、コードのコントリビュート等、皆様のご協力を歓迎しております。

インストール

$ go get github.com/soracom/soracom-sdk-go

Go のインストール、$GOPATH の設定などは事前に行っておいてください。 Go のバージョンは 1.5.1 (arm64/darwin) で動作確認を行いましたが、他のバージョンでも動作すると思います。

使用方法

APIClient のインスタンスを作成し、Auth() 関数で認証を行った後、各 API を呼び出します。以下の例では SIM (Subscriber) の一覧を取得して表示しています。

package main

import (
    "fmt"
    "github.com/soracom/soracom-sdk-go"
)

func main() {
    ac := soracom.NewAPIClient(nil)
    email := "test@example.com"
    password := "Your password should not be hard-coded here"

    err := ac.Auth(email, password)
    if err != nil {
        fmt.Printf("auth err: %v\n", err.Error())
        return
    }

    subscribers, _, err := ac.ListSubscribers(nil)
    if err != nil {
        fmt.Printf("err: %v\n", err.Error())
        return
    }

    fmt.Printf("%v", subscribers)
}

メタデータサービスにも対応しています。 メタデータサービスを利用するには soracom.NewMetadataClient(nil) を呼び出して MetadataClient を作成します。

package main

import (
	"fmt"
	"github.com/soracom/soracom-sdk-go"
)

func main() {
	mc := soracom.NewMetadataClient(nil)
	sub, err := mc.GetSubscriber()
	if err != nil {
		fmt.Printf("error: %v", err)
		return
	}
	fmt.Printf("subscriber: %v", sub)
}

もう少し詳しい使い方は http://qiita.com/bearmini/items/6e3f66bc0ef846c8d197 を参照してください。

Documentation

Index

Constants

View Source
const (
	// BeamTypeInHTTP is ...
	BeamTypeInHTTP = "inHttp"
	// BeamTypeInMQTT is ...
	BeamTypeInMQTT = "inMqtt"
	// BeamTypeInTCP is ...
	BeamTypeInTCP = "inTcp"
	// BeamTypeInUDP is ...
	BeamTypeInUDP = "inUdp"
	// BeamTypeOutHTTP is ...
	BeamTypeOutHTTP = "outHttp"
	// BeamTypeOutHTTPS is ...
	BeamTypeOutHTTPS = "outHttps"
	// BeamTypeOutMQTT is ...
	BeamTypeOutMQTT = "outMqtt"
	// BeamTypeOutMQTTS is ...
	BeamTypeOutMQTTS = "outMqtts"
	// BeamTypeOutTCP is ...
	BeamTypeOutTCP = "outTcp"
	// BeamTypeOutTCPS is ...
	BeamTypeOutTCPS = "outTcps"
	// BeamTypeOutUDP is ...
	BeamTypeOutUDP = "outUdp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	APIKey     string
	Token      string
	OperatorID string
	// contains filtered or unexported fields
}

APIClient provides an access to SORACOM REST API

func NewAPIClient

func NewAPIClient(options *APIClientOptions) *APIClient

NewAPIClient creates an instance of APIClient

func (*APIClient) ActivateSubscriber

func (ac *APIClient) ActivateSubscriber(imsi string) (*Subscriber, error)

ActivateSubscriber activates a subscriber.

func (*APIClient) Auth

func (ac *APIClient) Auth(email, password string) error

Auth does the authentication process. Gets an API key and an API Token

func (*APIClient) CreateCoupon

func (ac *APIClient) CreateCoupon(options *CreatedCouponOptions) (*CreatedCoupon, error)

CreateCoupon sends a request to create a brand-new coupon

func (*APIClient) CreateEventHandler

func (ac *APIClient) CreateEventHandler(options *CreateEventHandlerOptions) error

CreateEventHandler creates an event handler

func (*APIClient) CreateGroup

func (ac *APIClient) CreateGroup(tags Tags) (*Group, error)

CreateGroup creates a group

func (*APIClient) CreateGroupWithName

func (ac *APIClient) CreateGroupWithName(name string) (*Group, error)

CreateGroupWithName creates a group with name

func (*APIClient) CreateOperator

func (ac *APIClient) CreateOperator(email, password string) error

CreateOperator sends a request to create an operator with the specified email & password.

func (*APIClient) CreateSubscriber

func (ac *APIClient) CreateSubscriber() (*CreatedSubscriber, error)

CreateSubscriber sends a request to create a brand-new subscriber

func (*APIClient) DeactivateSubscriber

func (ac *APIClient) DeactivateSubscriber(imsi string) (*Subscriber, error)

DeactivateSubscriber deactivates a subscriber.

func (*APIClient) DeleteEventHandler

func (ac *APIClient) DeleteEventHandler(handlerID string) error

DeleteEventHandler deletes the specified event handler

func (*APIClient) DeleteGroup

func (ac *APIClient) DeleteGroup(groupID string) error

DeleteGroup deletes a group

func (*APIClient) DeleteGroupConfiguration

func (ac *APIClient) DeleteGroupConfiguration(groupID, namespace, name string) (*Group, error)

DeleteGroupConfiguration deletes a configuration for a group

func (*APIClient) DeleteGroupTag

func (ac *APIClient) DeleteGroupTag(groupID, tagName string) error

DeleteGroupTag deletes a tag for a group

func (*APIClient) DeleteSandboxOperator

func (ac *APIClient) DeleteSandboxOperator() error

DeleteSandboxOperator delete a sandbox operator

func (*APIClient) DeleteSubscriberTag

func (ac *APIClient) DeleteSubscriberTag(imsi string, tagName string) error

DeleteSubscriberTag deletes a tag on a subscriber

func (*APIClient) DisableSubscriberTermination

func (ac *APIClient) DisableSubscriberTermination(imsi string) (*Subscriber, error)

DisableSubscriberTermination disables termination of a subscriber.

func (*APIClient) EnableSubscriberTermination

func (ac *APIClient) EnableSubscriberTermination(imsi string) (*Subscriber, error)

EnableSubscriberTermination enables termination of a subscriber.

func (*APIClient) ExportAirStats

func (ac *APIClient) ExportAirStats(from, to time.Time, period StatsPeriod) (*url.URL, error)

ExportAirStats gets a URL to download a CSV file which contains stats of all Air SIMs for the operator for a specified period

func (*APIClient) ExportBeamStats

func (ac *APIClient) ExportBeamStats(from, to time.Time, period StatsPeriod) (*url.URL, error)

ExportBeamStats gets a URL to download a CSV file which contains all stats of Beam for the operator for a specified period

func (*APIClient) GenerateAPIToken

func (ac *APIClient) GenerateAPIToken(timeout int) (string, error)

GenerateAPIToken generates an API token

func (*APIClient) GetAirStats

func (ac *APIClient) GetAirStats(imsi string, from, to time.Time, period StatsPeriod) ([]AirStats, error)

GetAirStats gets stats of Air for a subscriber for a specified period

func (*APIClient) GetBeamStats

func (ac *APIClient) GetBeamStats(imsi string, from, to time.Time, period StatsPeriod) ([]BeamStats, error)

GetBeamStats gets stats of Beam for a subscriber for a specified period

func (*APIClient) GetEventHandler

func (ac *APIClient) GetEventHandler(handlerID string) (*EventHandler, error)

GetEventHandler gets the specified event handler

func (*APIClient) GetGroup

func (ac *APIClient) GetGroup(groupID string) (*Group, error)

GetGroup gets detailed info about a group

func (*APIClient) GetOperator

func (ac *APIClient) GetOperator(operatorID string) (*Operator, error)

GetOperator gets information about an operator specifed by operatorID.

func (*APIClient) GetSignupToken

func (ac *APIClient) GetSignupToken(email, authKeyID, authKey string) (string, error)

GetSignupToken retrieves token to complete signup (sandbox environment only)

func (*APIClient) GetSubscriber

func (ac *APIClient) GetSubscriber(imsi string) (*Subscriber, error)

GetSubscriber gets information about a subscriber specifed by imsi.

func (*APIClient) GetSupportToken

func (ac *APIClient) GetSupportToken() (string, error)

GetSupportToken retrieves a token for accessing to the support site

func (*APIClient) InsertAirStats

func (ac *APIClient) InsertAirStats(imsi string, stats AirStats) error

InsertAirStats inserts a set of data communication stats with a timestamp for a subscriber

func (*APIClient) InsertBeamStats

func (ac *APIClient) InsertBeamStats(imsi string, stats BeamStats) error

InsertBeamStats inserts a set of beam stats with a timestamp for a subscriber

func (*APIClient) ListEventHandlers

func (ac *APIClient) ListEventHandlers(options *ListEventHandlersOptions) ([]EventHandler, error)

ListEventHandlers lists event handlers for the operator

func (*APIClient) ListEventHandlersForSubscriber

func (ac *APIClient) ListEventHandlersForSubscriber(imsi string) ([]EventHandler, error)

ListEventHandlersForSubscriber creates an event handler with the specified options

func (*APIClient) ListGroups

func (ac *APIClient) ListGroups(options *ListGroupsOptions) ([]Group, *PaginationKeys, error)

ListGroups lists groups for the operator

func (*APIClient) ListSubscribers

func (ac *APIClient) ListSubscribers(options *ListSubscribersOptions) ([]Subscriber, *PaginationKeys, error)

ListSubscribers lists subscribers for the operator

func (*APIClient) ListSubscribersInGroup

func (ac *APIClient) ListSubscribersInGroup(groupID string, options *ListSubscribersInGroupOptions) ([]Subscriber, *PaginationKeys, error)

ListSubscribersInGroup lists subscribers in a group

func (*APIClient) PutSubscriberTags

func (ac *APIClient) PutSubscriberTags(imsi string, tags []Tag) (*Subscriber, error)

PutSubscriberTags puts tags on a subscriber

func (*APIClient) RegisterPaymentMethodWebPay

func (ac *APIClient) RegisterPaymentMethodWebPay(wp *PaymentMethodInfoWebPay) error

RegisterPaymentMethodWebPay registers the specified WebPay information as an active payment method

func (*APIClient) RegisterSubscriber

func (ac *APIClient) RegisterSubscriber(imsi string, regOptions RegisterSubscriberOptions) (*Subscriber, error)

RegisterSubscriber registers a subscriber.

func (*APIClient) SetSubscriberExpiryTime

func (ac *APIClient) SetSubscriberExpiryTime(imsi string, expiryTime time.Time) (*Subscriber, error)

SetSubscriberExpiryTime sets expiration time of a subscriber.

func (*APIClient) SetSubscriberGroup

func (ac *APIClient) SetSubscriberGroup(imsi, groupID string) (*Subscriber, error)

SetSubscriberGroup sets a group of a subscriber.

func (*APIClient) SetVerbose

func (ac *APIClient) SetVerbose(verbose bool)

SetVerbose sets if verbose output is enabled or not

func (*APIClient) TerminateSubscriber

func (ac *APIClient) TerminateSubscriber(imsi string) (*Subscriber, error)

TerminateSubscriber terminates a subscriber.

func (*APIClient) UnsetSubscriberExpiryTime

func (ac *APIClient) UnsetSubscriberExpiryTime(imsi string) (*Subscriber, error)

UnsetSubscriberExpiryTime unsets expiration time of a subscriber.

func (*APIClient) UnsetSubscriberGroup

func (ac *APIClient) UnsetSubscriberGroup(imsi string) (*Subscriber, error)

UnsetSubscriberGroup unsets group of a subscriber.

func (*APIClient) UpdateAirConfig

func (ac *APIClient) UpdateAirConfig(groupID string, airConfig *AirConfig) (*Group, error)

UpdateAirConfig updates SORACOM Air configurations for a group

func (*APIClient) UpdateBeamTCPConfig

func (ac *APIClient) UpdateBeamTCPConfig(groupID, entryPoint string, beamTCPConfig *BeamTCPConfig) (*Group, error)

UpdateBeamTCPConfig updates SORACOM Beam configurations for a group

func (*APIClient) UpdateEventHandler

func (ac *APIClient) UpdateEventHandler(eh *EventHandler) error

UpdateEventHandler updates the specified event handler

func (*APIClient) UpdateGroupConfigurations

func (ac *APIClient) UpdateGroupConfigurations(groupID, namespace string, configurations []GroupConfig) (*Group, error)

UpdateGroupConfigurations updates configurations for a group

func (*APIClient) UpdateGroupTags

func (ac *APIClient) UpdateGroupTags(groupID string, tags []Tag) (*Group, error)

UpdateGroupTags updates tags a group

func (*APIClient) UpdatePassword

func (ac *APIClient) UpdatePassword(currentPassword, newPassword string) error

UpdatePassword updates operator's password

func (*APIClient) UpdateSubscriberSpeedClass

func (ac *APIClient) UpdateSubscriberSpeedClass(imsi, speedClass string) (*Subscriber, error)

UpdateSubscriberSpeedClass updates speed class of a subscriber.

func (*APIClient) VerifyOperator

func (ac *APIClient) VerifyOperator(token string) error

VerifyOperator sends a token to complete an operator creation process.

type APIClientOptions

type APIClientOptions struct {
	Endpoint string
}

APIClientOptions holds options for creating an APIClient

type APIError

type APIError struct {
	ErrorCode string
	Message   string
}

APIError represents an error ocurred while calling API

func NewAPIError

func NewAPIError(resp *http.Response) *APIError

NewAPIError creates an instance of APIError from http.Response

func (*APIError) Error

func (ae *APIError) Error() string

type ActionConfig

type ActionConfig struct {
	Type       EventHandlerActionType `json:"type"`
	Properties Properties             `json:"properties"`
}

ActionConfig contains an action to be invoked when a condition is satisfied

type AirConfig

type AirConfig struct {
	UseCustomDNS bool     `json:"useCustomDns"`
	DNSServers   []string `json:"dnsServers"`
	MetaData     MetaData `json:"metadata"`
	UserData     string   `json:"userdata"`
}

AirConfig holds configuration parameters for SORACOM Air

func (*AirConfig) JSON

func (ac *AirConfig) JSON() string

JSON converts AirConfig into JSON string

type AirStats

type AirStats struct {
	Date     string                               `json:"date"`
	Unixtime uint64                               `json:"unixtime"`
	Traffic  map[SpeedClass]AirStatsForSpeedClass `json:"dataTrafficStatsMap"`
}

AirStats holds a set of traffic information for each speed class

func (*AirStats) JSON

func (o *AirStats) JSON() string

JSON retunrs a JSON representing AirStats object

type AirStatsForSpeedClass

type AirStatsForSpeedClass struct {
	UploadBytes     uint64 `json:"uploadByteSizeTotal"`
	UploadPackets   uint64 `json:"uploadPacketSizeTotal"`
	DownloadBytes   uint64 `json:"downloadByteSizeTotal"`
	DownloadPackets uint64 `json:"downloadPacketSizeTotal"`
}

AirStatsForSpeedClass holds Upload/Download Bytes/Packets for a speed class

type AuthKey

type AuthKey struct {
	AuthKeyID     string `json:"authKeyId"`
	AuthKeySecret string `json:"authKey"`
}

AuthKey contains AuthKeyID and AuthKeySecret

func (*AuthKey) JSON

func (ak *AuthKey) JSON() string

JSON returns JSON representing AuthKey

type AuthRequest

type AuthRequest struct {
	Email               string `json:"email"`
	Password            string `json:"password"`
	TokenTimeoutSeconds int    `json:"tokenTimeoutSeconds"`
}

AuthRequest contains parameters for /auth API

func (*AuthRequest) JSON

func (ar *AuthRequest) JSON() string

JSON returns JSON representing AuthRequest

type AuthResponse

type AuthResponse struct {
	APIKey     string `json:"apiKey"`
	OperatorID string `json:"operatorId"`
	Token      string `json:"token"`
}

AuthResponse contains all values returned from /auth API

type BeamHTTPConfig

type BeamHTTPConfig struct {
	Name                string                  `json:"name"`
	Destination         string                  `json:"destination"`
	Enabled             bool                    `json:"enabled"`
	AddSubscriberHeader bool                    `json:"addSubscriberHeader"`
	AddSignature        bool                    `json:"addSignature"`
	CustomHeaders       map[string]CustomHeader `json:"customHeaders"`
	PSK                 string                  `json:"psk"`
}

BeamHTTPConfig holds SORACOM Beam HTTP entry point configurations

type BeamMQTTConfig

type BeamMQTTConfig struct {
	Name                  string                 `json:"name"`
	Destination           string                 `json:"destination"`
	Enabled               bool                   `json:"enabled"`
	AddSubscriberHeader   bool                   `json:"addSubscriberHeader"`
	Username              string                 `json:"username"`
	Password              string                 `json:"password"`
	UseClientCertificates string                 `json:"useClientCert"`
	ClientCertificates    map[string]ClientCerts `json:"clientCerts"`
}

BeamMQTTConfig holds SORACOM Beam MQTT entry point configurations

type BeamStats

type BeamStats struct {
	Date     string                        `json:"date"`
	Unixtime uint64                        `json:"unixtime"`
	Traffic  map[BeamType]BeamStatsForType `json:"beamStatsMap"`
}

BeamStats holds a set of traffic information for each speed class

func (*BeamStats) JSON

func (o *BeamStats) JSON() string

JSON retunrs a JSON representing BeamStats object

type BeamStatsForType

type BeamStatsForType struct {
	Count uint64 `json:"count"`
}

BeamStatsForType holds Upload/Download Bytes/Packets for a speed class

type BeamTCPConfig

type BeamTCPConfig struct {
	Name                string `json:"name"`
	Destination         string `json:"destination"`
	Enabled             bool   `json:"enabled"`
	AddSubscriberHeader bool   `json:"addSubscriberHeader"`
	AddSignature        bool   `json:"addSignature"`
	PSK                 string `json:"psk"`
}

BeamTCPConfig holds SORACOM Beam TCP entry point configurations

type BeamType

type BeamType string

BeamType represents one of in/out protocols for Beam

type BeamUDPConfig

type BeamUDPConfig struct {
	Name                string `json:"name"`
	Destination         string `json:"destination"`
	Enabled             bool   `json:"enabled"`
	AddSubscriberHeader bool   `json:"addSubscriberHeader"`
	AddSignature        bool   `json:"addSignature"`
	PSK                 string `json:"psk"`
}

BeamUDPConfig holds SORACOM Beam UDP entry point configurations

type ClientCerts

type ClientCerts struct {
	CA         string `json:"ca"`
	Cert       string `json:"cert"`
	PrivateKey string `json:"key"`
}

ClientCerts consists of a CA certificate,

type ConfigNamespace

type ConfigNamespace string

ConfigNamespace is a type of namespace of a configuration

type CreateEventHandlerOptions

type CreateEventHandlerOptions struct {
	TargetImsi       *string        `json:"targetImsi"`
	TargetOperatorID *string        `json:"targetOperatorId"`
	TargetTag        *Tags          `json:"targetTag"`
	TargetGroupID    *string        `json:"targetGroupId"`
	Name             string         `json:"name"`
	Description      string         `json:"description"`
	RuleConfig       RuleConfig     `json:"ruleConfig"`
	Status           string         `json:"status"`
	ActionConfigList []ActionConfig `json:"actionConfigList"`
}

CreateEventHandlerOptions keeps information to create an event handler

func (*CreateEventHandlerOptions) JSON

JSON converts CreateEventhandlerOptions into a JSON string

type CreatedCoupon

type CreatedCoupon struct {
	CouponCode             string `json:"couponCode"`
	Amount                 int    `json:"amount"`
	ApplicableBillItemName string `json:"applicableBillItemName"`
	ExpiryYearMonth        string `json:"expiryYearMonth"`
}

type CreatedCouponOptions

type CreatedCouponOptions struct {
	Amount                 int    `json:"amount"`
	ApplicableBillItemName string `json:"applicableBillItemName"`
	ExpiryYearMonth        string `json:"expiryYearMonth"`
}

func (*CreatedCouponOptions) JSON

func (o *CreatedCouponOptions) JSON() string

JSON converts CreatedCouponOptions into a JSON string

type CreatedSubscriber

type CreatedSubscriber struct {
	Imsi               string `json:"imsi"`
	Msisdn             string `json:"msisdn"`
	RegistrationSecret string `json:"registrationSecret"`
}

CreatedSubscriber keeps information of a created subscriber

type CustomHeader

type CustomHeader struct {
	Action string `json:"action"`
	Key    string `json:"headerKey"`
	Value  string `json:"headerValue"`
}

CustomHeader holds Action, Key and Value for a custom header

type EventHandler

type EventHandler struct {
	HandlerID        string         `json:"handlerId"`
	TargetImsi       *string        `json:"targetImsi"`
	TargetOperatorID *string        `json:"targetOperatorId"`
	TargetTag        *Tags          `json:"targetTag"`
	TargetGroupID    *string        `json:"targetGroupId"`
	Name             string         `json:"name"`
	Description      string         `json:"description"`
	RuleConfig       RuleConfig     `json:"ruleConfig"`
	Status           string         `json:"status"`
	ActionConfigList []ActionConfig `json:"actionConfigList"`
}

EventHandler keeps information about an event handler

func (*EventHandler) JSON

func (o *EventHandler) JSON() string

JSON converts Eventhandler into a JSON string

type EventHandlerActionType

type EventHandlerActionType string

EventHandlerActionType is a type of event hander's action

const (
	// EventHandlerActionTypeUnspecified means that the type field in ActionConfigList has not been specified
	EventHandlerActionTypeUnspecified EventHandlerActionType = ""

	// EventHandlerActionTypeChangeSpeedClass indicates a type of action to be invoked to change speed class for a subscriber once a condition is satisfied
	EventHandlerActionTypeChangeSpeedClass EventHandlerActionType = "ChangeSpeedClassAction"

	// EventHandlerActionTypeSendMail indicates a type of action to be invoked to send an email once a condition is satisfied
	EventHandlerActionTypeSendMail EventHandlerActionType = "SendMailAction"

	// EventHandlerActionTypeInvokeAWSLambda indicates a type of action to be invoked to invoke AWS Lambda function once a condition is satisfied
	EventHandlerActionTypeInvokeAWSLambda EventHandlerActionType = "InvokeAWSLambdaAction"
)

type EventHandlerRuleType

type EventHandlerRuleType string

EventHandlerRuleType is a type of event hander's rule

const (
	// EventHandlerRuleTypeUnspecified means that the type field in RuleConfig has not been specified
	EventHandlerRuleTypeUnspecified EventHandlerRuleType = ""

	// EventHandlerRuleTypeDailyTraffic is a rule type to invoke actions when data traffic for a day for a subscriber exceeds the specified limit
	EventHandlerRuleTypeDailyTraffic EventHandlerRuleType = "DailyTrafficRule"

	// EventHandlerRuleTypeMonthlyTraffic is a rule type to invoke actions when data traffic for a month for a subscriber exceeds the specified limit
	EventHandlerRuleTypeMonthlyTraffic EventHandlerRuleType = "MonthlyTraffic"

	// EventHandlerRuleTypeCumulativeTraffic is a rule type to invoke actions when cumulative data traffic for a subscriber exceeds the specified limit
	EventHandlerRuleTypeCumulativeTraffic EventHandlerRuleType = "CumulativeTraffic"

	// EventHandlerRuleTypeDailyTotalTraffic is a rule type to invoke actions when total data traffic for a day for all subscribers exceeds the specified limit
	EventHandlerRuleTypeDailyTotalTraffic EventHandlerRuleType = "DailyTotalTraffic"

	// EventHandlerRuleTypeMonthlyTotalTraffic is a rule type to invoke actions when total data traffic for a month for all subscribers exceeds the specified limit
	EventHandlerRuleTypeMonthlyTotalTraffic EventHandlerRuleType = "MonthlyTotalTraffic"

	// EventHandlerRuleTypeSubscriberStatusChanged is a rule type to invoke actions when status of a subscriber has been changed
	EventHandlerRuleTypeSubscriberStatusChanged EventHandlerRuleType = "SubscriberStatusChanged"

	// EventHandlerRuleTypeSubscriberSpeedClassChanged is a rule type to invoke actions when speed class of a subscriber has been changed
	EventHandlerRuleTypeSubscriberSpeedClassChanged EventHandlerRuleType = "SubscriberSpeedClassChanged"
)

type GenerateAPITokenResponse

type GenerateAPITokenResponse struct {
	Token string `json:"token"`
}

GenerateAPITokenResponse contains all values returned from /operators/{operator_id}/token API

type GetSupportTokenResponse

type GetSupportTokenResponse struct {
	Token string `json:"token"`
}

GetSupportTokenResponse contains all values returned from /operators/{operator_id}/support/token API.

type Group

type Group struct {
	Configuration    map[ConfigNamespace]interface{} `json:"configuration"`
	CreatedTime      *TimestampMilli                 `json:"createdTime"`
	GroupID          string                          `json:"groupId"`
	LastModifiedTime *TimestampMilli                 `json:"lastModifiedTime"`
	OperatorID       string                          `json:"operatorId"`
	Tags             Tags                            `json:"tags"`
}

Group keeps information about a group

type GroupConfig

type GroupConfig struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

GroupConfig holds a pair of a key and a value

type ListEventHandlersOptions

type ListEventHandlersOptions struct {
	Target string
}

ListEventHandlersOptions holds options for APIClient.ListEventHandlers()

func (*ListEventHandlersOptions) String

func (leho *ListEventHandlersOptions) String() string

type ListGroupsOptions

type ListGroupsOptions struct {
	TagName           string
	TagValue          string
	TagValueMatchMode TagValueMatchMode
	Limit             int
	LastEvaluatedKey  string
}

ListGroupsOptions holds options for APIClient.ListGroups()

func (*ListGroupsOptions) String

func (lso *ListGroupsOptions) String() string

type ListSubscribersInGroupOptions

type ListSubscribersInGroupOptions struct {
	Limit            int
	LastEvaluatedKey string
}

ListSubscribersInGroupOptions holds options for APIClient.ListSubscribersInGroup()

func (*ListSubscribersInGroupOptions) String

func (lso *ListSubscribersInGroupOptions) String() string

type ListSubscribersOptions

type ListSubscribersOptions struct {
	TagName           string
	TagValue          string
	TagValueMatchMode TagValueMatchMode
	StatusFilter      string
	TypeFilter        string
	Limit             int
	LastEvaluatedKey  string
}

ListSubscribersOptions holds options for APIClient.ListSubscribers()

func (*ListSubscribersOptions) String

func (lso *ListSubscribersOptions) String() string

type MetaData

type MetaData struct {
	Enabled     bool   `json:"enabled"`
	ReadOnly    bool   `json:"readonly"`
	AllowOrigin string `json:"allowOrigin"`
}

MetaData holds configuration for SORACOM Air Metadata

type MetadataClient

type MetadataClient struct {
	// contains filtered or unexported fields
}

MetadataClient provides an access to SORACOM Metadata Service APIs

func NewMetadataClient

func NewMetadataClient(options *MetadataClientOptions) *MetadataClient

NewMetadataClient creates an instance of MetadataClient

func (*MetadataClient) DeleteTag

func (mc *MetadataClient) DeleteTag(tagName string) error

DeleteTag deletes a tag on the calling subscriber

func (*MetadataClient) DisableTermination

func (mc *MetadataClient) DisableTermination() (*Subscriber, error)

DisableTermination disables termination of the calling subscriber.

func (*MetadataClient) EnableTermination

func (mc *MetadataClient) EnableTermination() (*Subscriber, error)

EnableTermination enables termination of the calling subscriber.

func (*MetadataClient) GetSubscriber

func (mc *MetadataClient) GetSubscriber() (*Subscriber, error)

GetSubscriber gets metadata for the calling subscriber

func (*MetadataClient) GetUserdata

func (mc *MetadataClient) GetUserdata() (string, error)

GetUserdata gets userdata for the calling subscriber's group

func (*MetadataClient) PutTags

func (mc *MetadataClient) PutTags(tags []Tag) (*Subscriber, error)

PutTags puts tags on the calling subscriber

func (*MetadataClient) SetExpiryTime

func (mc *MetadataClient) SetExpiryTime(expiryTime time.Time) (*Subscriber, error)

SetExpiryTime sets expiration time of the calling subscriber.

func (*MetadataClient) SetGroup

func (mc *MetadataClient) SetGroup(groupID string) (*Subscriber, error)

SetGroup sets a group of the calling subscriber.

func (*MetadataClient) UnsetExpiryTime

func (mc *MetadataClient) UnsetExpiryTime() (*Subscriber, error)

UnsetExpiryTime unsets expiration time of the calling subscriber.

func (*MetadataClient) UnsetGroup

func (mc *MetadataClient) UnsetGroup() (*Subscriber, error)

UnsetGroup unsets group of the calling subscriber.

func (*MetadataClient) UpdateSpeedClass

func (mc *MetadataClient) UpdateSpeedClass(speedClass string) (*Subscriber, error)

UpdateSpeedClass updates speed class of the calling subscriber.

type MetadataClientOptions

type MetadataClientOptions struct {
	Endpoint string
}

MetadataClientOptions holds options for creating an MetadataClient

type Operator

type Operator struct {
	OperatorID     string     `json:"operatorId"`
	RootOperatorID *string    `json:"rootOperatorId"`
	Email          string     `json:"email"`
	Description    *string    `json:"description"`
	CreateDate     *time.Time `json:"createDate"`
	UpdateDate     *time.Time `json:"updateDate"`
}

Operator keeps information about an operator

type PaginationKeys

type PaginationKeys struct {
	Prev string
	Next string
}

PaginationKeys holds keys for pagination

type PaymentMethodInfoWebPay

type PaymentMethodInfoWebPay struct {
	Cvc         string `json:"cvc"`
	ExpireMonth int    `json:"expireMonth"`
	ExpireYear  int    `json:"expireYear"`
	Name        string `json:"name"`
	Number      string `json:"number"`
}

PaymentMethodInfoWebPay keeps information of an WebPay payment method

func (*PaymentMethodInfoWebPay) JSON

func (o *PaymentMethodInfoWebPay) JSON() string

JSON converts PaymentMethodInfoWebPay into a JSON string

type Properties

type Properties map[string]string

Properties is a map of property name and propaty value

type RegisterSubscriberOptions

type RegisterSubscriberOptions struct {
	RegistrationSecret string `json:"registrationSecret"`
	GroupID            string `json:"groupId"`
	Tags               Tags   `json:"tags"`
}

RegisterSubscriberOptions keeps information for registering a subscriber

func (*RegisterSubscriberOptions) JSON

func (rso *RegisterSubscriberOptions) JSON() string

JSON retunrs a JSON representing RegisterSubscriberOptions object

type RuleConfig

type RuleConfig struct {
	Type       EventHandlerRuleType `json:"type"`
	Properties Properties           `json:"properties"`
}

RuleConfig contains a condition to invoke actions

type SandboxGetSignupTokenResponse

type SandboxGetSignupTokenResponse struct {
	Token string `json:"token"`
}

SandboxGetSignupTokenResponse keeps information of a signup token

type SessionStatus

type SessionStatus struct {
	DNSServers    []string        `json:"dnsServers"`
	Imei          string          `json:"imei"`
	LastUpdatedAt *TimestampMilli `json:"lastUpdatedAt"`
	Location      *string         `json:"location"`
	Online        bool            `json:"online"`
	UEIPAddress   string          `json:"ueIpAddress"`
}

SessionStatus keeps information about a session

type SpeedClass

type SpeedClass string

SpeedClass represents one of speed classes

const (
	// SpeedClassS1Minimum is s1.minimum
	SpeedClassS1Minimum SpeedClass = "s1.minimum"

	// SpeedClassS1Slow is s1.slow
	SpeedClassS1Slow SpeedClass = "s1.slow"

	// SpeedClassS1Standard is s1.standard
	SpeedClassS1Standard SpeedClass = "s1.standard"

	// SpeedClassS1Fast is s1.fast
	SpeedClassS1Fast SpeedClass = "s1.fast"
)

type StatsPeriod

type StatsPeriod int

StatsPeriod is a period to gather stats

const (
	// StatsPeriodUnspecified means no StatsPeriod is specified
	StatsPeriodUnspecified StatsPeriod = iota

	// StatsPeriodMonth means the period of gathering stats is 'month'
	StatsPeriodMonth

	// StatsPeriodDay means that the period of gathering stats is 'day'
	StatsPeriodDay

	// StatsPeriodMinutes means that the period of gathering stats is 'minutes'
	StatsPeriodMinutes
)

func (StatsPeriod) Parse

func (p StatsPeriod) Parse(s string) StatsPeriod

Parse parses the specified string and returns a StatsPeriod value represented by the string

func (StatsPeriod) String

func (p StatsPeriod) String() string

type Subscriber

type Subscriber struct {
	Apn                string          `json:"apn"`
	CreatedTime        *TimestampMilli `json:"createdTime"`
	ExpiryTime         *TimestampMilli `json:"expiryTime"`
	GroupID            *string         `json:"groupId"`
	Imsi               string          `json:"imsi"`
	IPAddress          *string         `json:"ipAddress"`
	LastModifiedTime   *TimestampMilli `json:"lastModifiedTime"`
	ModuleType         string          `json:"ModuleType"`
	Msisdn             string          `json:"msisdn"`
	OperatorID         string          `json:"operatorId"`
	Plan               int             `json:"plan"`
	SessionStatus      *SessionStatus  `json:"sessionStatus"`
	Status             string          `json:"status"`
	SpeedClass         string          `json:"speedClass"`
	Tags               Tags            `json:"tags"`
	TerminationEnabled bool            `json:"terminationEnabled"`
}

Subscriber keeps information about a subscriber

type Tag

type Tag struct {
	TagName  string `json:"tagName"`
	TagValue string `json:"tagValue"`
}

Tag is a pair of Name and Value.

type TagValueMatchMode

type TagValueMatchMode int

TagValueMatchMode is one of MatchModeUnspecified, MatchModeExact or MatchModePrefix

const (
	// MatchModeUnspecified is a value of TagValueMatchMode.
	// For list functions, they don't match tag values (i.e. list all items regardless of values of tags) if this value is specified.
	MatchModeUnspecified TagValueMatchMode = iota

	// MatchModeExact is a value of TagValueMatchMode.
	// For list functions, they do exact match for tag values if this value is specified.
	MatchModeExact

	// MatchModePrefix is a value of TagValueMatchMode.
	// For list functions, they do prefix match for tag values if this value is specified.
	MatchModePrefix
)

func (TagValueMatchMode) Parse

Parse parses a provided string and returns TagValueMatchMode

func (TagValueMatchMode) String

func (m TagValueMatchMode) String() string

type Tags

type Tags map[string]string

Tags is a map of tag name and tag value

type TimestampMilli

type TimestampMilli struct {
	time.Time
}

TimestampMilli is ...

func (*TimestampMilli) MarshalJSON

func (t *TimestampMilli) MarshalJSON() ([]byte, error)

MarshalJSON is ...

func (*TimestampMilli) UnixMilli

func (t *TimestampMilli) UnixMilli() int64

UnixMilli returns t as a Unix time, the number of milliseconds elapsed since January 1, 1970 UTC.

func (*TimestampMilli) UnmarshalJSON

func (t *TimestampMilli) UnmarshalJSON(b []byte) error

UnmarshalJSON is ...

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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