packer-cn/vendor/github.com/denverdino/aliyungo/ram/mfa.go

88 lines
2.0 KiB
Go
Raw Normal View History

2017-03-04 05:06:32 -05:00
package ram
type MFARequest struct {
VirtualMFADeviceName string
}
2017-03-04 05:06:32 -05:00
type MFADeleteRequest struct {
MFADevice
}
2017-03-04 05:06:32 -05:00
type MFABindRequest struct {
SerialNumber string
UserName string
AuthenticationCode1 string
AuthenticationCode2 string
}
2017-03-04 05:06:32 -05:00
type MFAResponse struct {
RamCommonResponse
VirtualMFADevice VirtualMFADevice
}
2017-03-04 05:06:32 -05:00
type MFAListResponse struct {
RamCommonResponse
VirtualMFADevices struct {
VirtualMFADevice []VirtualMFADevice
}
}
type MFAUserResponse struct {
RamCommonResponse
MFADevice MFADevice
}
func (client *RamClient) CreateVirtualMFADevice(req MFARequest) (MFAResponse, error) {
var resp MFAResponse
err := client.Invoke("CreateVirtualMFADevice", req, &resp)
if err != nil {
return MFAResponse{}, err
}
return resp, nil
}
func (client *RamClient) ListVirtualMFADevices() (MFAListResponse, error) {
var resp MFAListResponse
err := client.Invoke("ListVirtualMFADevices", struct{}{}, &resp)
if err != nil {
return MFAListResponse{}, err
}
return resp, nil
}
func (client *RamClient) DeleteVirtualMFADevice(req MFADeleteRequest) (RamCommonResponse, error) {
var resp RamCommonResponse
err := client.Invoke("DeleteVirtualMFADevice", req, &resp)
if err != nil {
return RamCommonResponse{}, err
}
return resp, nil
}
func (client *RamClient) BindMFADevice(req MFABindRequest) (RamCommonResponse, error) {
var resp RamCommonResponse
err := client.Invoke("BindMFADevice", req, &resp)
if err != nil {
return RamCommonResponse{}, err
}
return resp, nil
}
func (client *RamClient) UnbindMFADevice(req UserQueryRequest) (MFAUserResponse, error) {
var resp MFAUserResponse
err := client.Invoke("UnbindMFADevice", req, &resp)
if err != nil {
return MFAUserResponse{}, err
}
return resp, nil
}
func (client *RamClient) GetUserMFAInfo(req UserQueryRequest) (MFAUserResponse, error) {
var resp MFAUserResponse
err := client.Invoke("GetUserMFAInfo", req, &resp)
if err != nil {
return MFAUserResponse{}, err
}
return resp, nil
}