github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/identity/v3/users/CreateBindingDevice.go (about)

     1  package users
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type BindMfaDevice struct {
     9  	// ID of the user to whom you will bind the virtual MFA device.
    10  	UserId string `json:"user_id"`
    11  	// Serial number of the virtual MFA device.
    12  	SerialNumber string `json:"serial_number"`
    13  	// Verification code 1.
    14  	AuthenticationCodeFirst string `json:"authentication_code_first"`
    15  	// Verification code 2.
    16  	AuthenticationCodeSecond string `json:"authentication_code_second"`
    17  }
    18  
    19  func CreateBindingDevice(client *golangsdk.ServiceClient, opts BindMfaDevice) (err error) {
    20  	b, err := build.RequestBody(opts, "")
    21  	if err != nil {
    22  		return
    23  	}
    24  
    25  	// PUT /v3.0/OS-MFA/mfa-devices/bind
    26  	_, err = client.Put(v30(client.ServiceURL("OS-MFA", "virtual-mfa-devices", "bind")), b, nil, &golangsdk.RequestOpts{
    27  		OkCodes: []int{204},
    28  	})
    29  	return
    30  }