github.com/sacloud/iaas-api-go@v1.12.0/naked/esme.go (about)

     1  // Copyright 2022-2023 The sacloud/iaas-api-go Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package naked
    16  
    17  import (
    18  	"time"
    19  
    20  	"github.com/sacloud/iaas-api-go/types"
    21  )
    22  
    23  // ESME 2要素認証 SMS送信サービス
    24  type ESME struct {
    25  	ID           types.ID            `json:",omitempty" yaml:"id,omitempty" structs:",omitempty"`
    26  	Name         string              `json:",omitempty" yaml:"name,omitempty" structs:",omitempty"`
    27  	Description  string              `yaml:"description"`
    28  	Tags         types.Tags          `yaml:"tags"`
    29  	Icon         *Icon               `json:",omitempty" yaml:"icon,omitempty" structs:",omitempty"`
    30  	CreatedAt    *time.Time          `json:",omitempty" yaml:"created_at,omitempty" structs:",omitempty"`
    31  	ModifiedAt   *time.Time          `json:",omitempty" yaml:"modified_at,omitempty" structs:",omitempty"`
    32  	Availability types.EAvailability `json:",omitempty" yaml:"availability,omitempty" structs:",omitempty"`
    33  	ServiceClass string              `json:",omitempty" yaml:"service_class,omitempty" structs:",omitempty"`
    34  	Provider     *Provider           `json:",omitempty" yaml:"provider,omitempty" structs:",omitempty"`
    35  
    36  	/* Note: 以下3フィールドはCommonServiceItem共通フィールドだがESMEでは常にnullとなっているためここでは定義しない */
    37  
    38  	// Settings     *ESMESettings `json:",omitempty" yaml:"settings,omitempty" structs:",omitempty"`
    39  	// SettingsHash string              `json:",omitempty" yaml:"setting_hash,omitempty" structs:",omitempty"`
    40  	// Status       *ESMEStatus `json:",omitempty" yaml:"status,omitempty" structs:",omitempty"`
    41  }
    42  
    43  // ESMESendSMSRequest SMS送信リクエスト
    44  type ESMESendSMSRequest struct {
    45  	Destination  string              `json:"destination,omitempty" yaml:"destination,omitempty" structs:",omitempty"` // 宛先 現在は81(+81)開始固定
    46  	Sender       string              `json:"sender,omitempty" yaml:"sender,omitempty" structs:",omitempty"`           // 送信者名 本文中に反映される
    47  	DomainName   string              `json:"domain_name,omitempty" yaml:"domain_name,omitempty" structs:",omitempty"` // Web OTPを利用する際に本文中に記載されるオリジン(FQDNで指定)
    48  	OTPOperation types.EOTPOperation `json:"otpOperation,omitempty" yaml:"otp_operation,omitempty" structs:",omitempty"`
    49  	OTP          string              `json:"otp,omitempty" yaml:"otp,omitempty" structs:",omitempty"` // ワンタイムパスワード、OTPOperationがinputの場合に使用する
    50  }
    51  
    52  // ESMESendSMSResponse SMS送信結果
    53  type ESMESendSMSResponse struct {
    54  	MessageID string `json:"messageId,omitempty" yaml:"message_id,omitempty" structs:",omitempty"`
    55  	Status    string `json:"status,omitempty" yaml:"status,omitempty" structs:",omitempty"` // Accepted/Delivered以外にもエラーなどの認識していないデータがありそうなためtypesで型を定義せず一旦string型としておく
    56  	OTP       string `json:"otp,omitempty" yaml:"otp,omitempty" structs:",omitempty"`
    57  }
    58  
    59  type ESMELogs struct {
    60  	Logs []*ESMELog `json:"logs,omitempty" yaml:"logs,omitempty"`
    61  }
    62  
    63  type ESMELog struct {
    64  	MessageID   string     `json:"messageId,omitempty" yaml:"message_id,omitempty" structs:",omitempty"`
    65  	Status      string     `json:"status,omitempty" yaml:"status,omitempty" structs:",omitempty"` // Accepted/Delivered以外にもエラーなどの認識していないデータがありそうなためtypesで型を定義せず一旦string型としておく
    66  	OTP         string     `json:"otp,omitempty" yaml:"otp,omitempty" structs:",omitempty"`
    67  	Destination string     `json:"destination,omitempty" yaml:"destination,omitempty" structs:",omitempty"`
    68  	SentAt      *time.Time `json:"sentAt,omitempty" yaml:"sent_at,omitempty" structs:",omitempty"`
    69  	DoneAt      *time.Time `json:"doneAt,omitempty" yaml:"done_at,omitempty" structs:",omitempty"`
    70  	RetryCount  int        `json:"retryCounnt,omitempty" yaml:"retry_count,omitempty" structs:",omitempty"`
    71  }