package vpc

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// SecondApplyPhysicalConnectionLOA invokes the vpc.SecondApplyPhysicalConnectionLOA API synchronously
func (client *Client) SecondApplyPhysicalConnectionLOA(request *SecondApplyPhysicalConnectionLOARequest) (response *SecondApplyPhysicalConnectionLOAResponse, err error) {
	response = CreateSecondApplyPhysicalConnectionLOAResponse()
	err = client.DoAction(request, response)
	return
}

// SecondApplyPhysicalConnectionLOAWithChan invokes the vpc.SecondApplyPhysicalConnectionLOA API asynchronously
func (client *Client) SecondApplyPhysicalConnectionLOAWithChan(request *SecondApplyPhysicalConnectionLOARequest) (<-chan *SecondApplyPhysicalConnectionLOAResponse, <-chan error) {
	responseChan := make(chan *SecondApplyPhysicalConnectionLOAResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.SecondApplyPhysicalConnectionLOA(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// SecondApplyPhysicalConnectionLOAWithCallback invokes the vpc.SecondApplyPhysicalConnectionLOA API asynchronously
func (client *Client) SecondApplyPhysicalConnectionLOAWithCallback(request *SecondApplyPhysicalConnectionLOARequest, callback func(response *SecondApplyPhysicalConnectionLOAResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *SecondApplyPhysicalConnectionLOAResponse
		var err error
		defer close(result)
		response, err = client.SecondApplyPhysicalConnectionLOA(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// SecondApplyPhysicalConnectionLOARequest is the request struct for api SecondApplyPhysicalConnectionLOA
type SecondApplyPhysicalConnectionLOARequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer                          `position:"Query" name:"ResourceOwnerId"`
	ClientToken          string                                    `position:"Query" name:"ClientToken"`
	LineType             string                                    `position:"Query" name:"LineType"`
	Si                   string                                    `position:"Query" name:"Si"`
	PeerLocation         string                                    `position:"Query" name:"PeerLocation"`
	ResourceOwnerAccount string                                    `position:"Query" name:"ResourceOwnerAccount"`
	Bandwidth            requests.Integer                          `position:"Query" name:"Bandwidth"`
	OwnerAccount         string                                    `position:"Query" name:"OwnerAccount"`
	ConstructionTime     string                                    `position:"Query" name:"ConstructionTime"`
	OwnerId              requests.Integer                          `position:"Query" name:"OwnerId"`
	InstanceId           string                                    `position:"Query" name:"InstanceId"`
	CompanyName          string                                    `position:"Query" name:"CompanyName"`
	PMInfo               *[]SecondApplyPhysicalConnectionLOAPMInfo `position:"Query" name:"PMInfo"  type:"Repeated"`
}

// SecondApplyPhysicalConnectionLOAPMInfo is a repeated param struct in SecondApplyPhysicalConnectionLOARequest
type SecondApplyPhysicalConnectionLOAPMInfo struct {
	PMCertificateNo   string `name:"PMCertificateNo"`
	PMName            string `name:"PMName"`
	PMCertificateType string `name:"PMCertificateType"`
	PMGender          string `name:"PMGender"`
	PMContactInfo     string `name:"PMContactInfo"`
}

// SecondApplyPhysicalConnectionLOAResponse is the response struct for api SecondApplyPhysicalConnectionLOA
type SecondApplyPhysicalConnectionLOAResponse struct {
	*responses.BaseResponse
	RequestId string `json:"RequestId" xml:"RequestId"`
}

// CreateSecondApplyPhysicalConnectionLOARequest creates a request to invoke SecondApplyPhysicalConnectionLOA API
func CreateSecondApplyPhysicalConnectionLOARequest() (request *SecondApplyPhysicalConnectionLOARequest) {
	request = &SecondApplyPhysicalConnectionLOARequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Vpc", "2016-04-28", "SecondApplyPhysicalConnectionLOA", "vpc", "openAPI")
	request.Method = requests.POST
	return
}

// CreateSecondApplyPhysicalConnectionLOAResponse creates a response to parse from SecondApplyPhysicalConnectionLOA response
func CreateSecondApplyPhysicalConnectionLOAResponse() (response *SecondApplyPhysicalConnectionLOAResponse) {
	response = &SecondApplyPhysicalConnectionLOAResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}
