// Code generated by volcengine with private/model/cli/gen-api/main.go. DO NOT EDIT.

package ark

import (
	"github.com/volcengine/volcengine-go-sdk/volcengine"
	"github.com/volcengine/volcengine-go-sdk/volcengine/request"
	"github.com/volcengine/volcengine-go-sdk/volcengine/response"
	"github.com/volcengine/volcengine-go-sdk/volcengine/volcengineutil"
)

const opGetEndpointCertificateCommon = "GetEndpointCertificate"

// GetEndpointCertificateCommonRequest generates a "volcengine/request.Request" representing the
// client's request for the GetEndpointCertificateCommon operation. The "output" return
// value will be populated with the GetEndpointCertificateCommon request's response once the request completes
// successfully.
//
// Use "Send" method on the returned GetEndpointCertificateCommon Request to send the API call to the service.
// the "output" return value is not valid until after GetEndpointCertificateCommon Send returns without error.
//
// See GetEndpointCertificateCommon for more information on using the GetEndpointCertificateCommon
// API call, and error handling.
//
//    // Example sending a request using the GetEndpointCertificateCommonRequest method.
//    req, resp := client.GetEndpointCertificateCommonRequest(params)
//
//    err := req.Send()
//    if err == nil { // resp is now filled
//        fmt.Println(resp)
//    }
func (c *ARK) GetEndpointCertificateCommonRequest(input *map[string]interface{}) (req *request.Request, output *map[string]interface{}) {
	op := &request.Operation{
		Name:       opGetEndpointCertificateCommon,
		HTTPMethod: "POST",
		HTTPPath:   "/",
	}

	if input == nil {
		input = &map[string]interface{}{}
	}

	output = &map[string]interface{}{}
	req = c.newRequest(op, input, output)

	req.HTTPRequest.Header.Set("Content-Type", "application/json; charset=utf-8")

	return
}

// GetEndpointCertificateCommon API operation for ARK.
//
// Returns volcengineerr.Error for service API and SDK errors. Use runtime type assertions
// with volcengineerr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the VOLCENGINE API reference guide for ARK's
// API operation GetEndpointCertificateCommon for usage and error information.
func (c *ARK) GetEndpointCertificateCommon(input *map[string]interface{}) (*map[string]interface{}, error) {
	req, out := c.GetEndpointCertificateCommonRequest(input)
	return out, req.Send()
}

// GetEndpointCertificateCommonWithContext is the same as GetEndpointCertificateCommon with the addition of
// the ability to pass a context and additional request options.
//
// See GetEndpointCertificateCommon for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur.
// In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ARK) GetEndpointCertificateCommonWithContext(ctx volcengine.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {
	req, out := c.GetEndpointCertificateCommonRequest(input)
	req.SetContext(ctx)
	req.ApplyOptions(opts...)
	return out, req.Send()
}

const opGetEndpointCertificate = "GetEndpointCertificate"

// GetEndpointCertificateRequest generates a "volcengine/request.Request" representing the
// client's request for the GetEndpointCertificate operation. The "output" return
// value will be populated with the GetEndpointCertificateCommon request's response once the request completes
// successfully.
//
// Use "Send" method on the returned GetEndpointCertificateCommon Request to send the API call to the service.
// the "output" return value is not valid until after GetEndpointCertificateCommon Send returns without error.
//
// See GetEndpointCertificate for more information on using the GetEndpointCertificate
// API call, and error handling.
//
//    // Example sending a request using the GetEndpointCertificateRequest method.
//    req, resp := client.GetEndpointCertificateRequest(params)
//
//    err := req.Send()
//    if err == nil { // resp is now filled
//        fmt.Println(resp)
//    }
func (c *ARK) GetEndpointCertificateRequest(input *GetEndpointCertificateInput) (req *request.Request, output *GetEndpointCertificateOutput) {
	op := &request.Operation{
		Name:       opGetEndpointCertificate,
		HTTPMethod: "POST",
		HTTPPath:   "/",
	}

	if input == nil {
		input = &GetEndpointCertificateInput{}
	}

	output = &GetEndpointCertificateOutput{}
	req = c.newRequest(op, input, output)

	req.HTTPRequest.Header.Set("Content-Type", "application/json; charset=utf-8")

	return
}

// GetEndpointCertificate API operation for ARK.
//
// Returns volcengineerr.Error for service API and SDK errors. Use runtime type assertions
// with volcengineerr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the VOLCENGINE API reference guide for ARK's
// API operation GetEndpointCertificate for usage and error information.
func (c *ARK) GetEndpointCertificate(input *GetEndpointCertificateInput) (*GetEndpointCertificateOutput, error) {
	req, out := c.GetEndpointCertificateRequest(input)
	return out, req.Send()
}

// GetEndpointCertificateWithContext is the same as GetEndpointCertificate with the addition of
// the ability to pass a context and additional request options.
//
// See GetEndpointCertificate for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. Ifthe context is nil a panic will occur.
// In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ARK) GetEndpointCertificateWithContext(ctx volcengine.Context, input *GetEndpointCertificateInput, opts ...request.Option) (*GetEndpointCertificateOutput, error) {
	req, out := c.GetEndpointCertificateRequest(input)
	req.SetContext(ctx)
	req.ApplyOptions(opts...)
	return out, req.Send()
}

type GetEndpointCertificateInput struct {
	_ struct{} `type:"structure" json:",omitempty"`

	// Id is a required field
	Id *string `type:"string" json:",omitempty" required:"true"`
}

// String returns the string representation
func (s GetEndpointCertificateInput) String() string {
	return volcengineutil.Prettify(s)
}

// GoString returns the string representation
func (s GetEndpointCertificateInput) GoString() string {
	return s.String()
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *GetEndpointCertificateInput) Validate() error {
	invalidParams := request.ErrInvalidParams{Context: "GetEndpointCertificateInput"}
	if s.Id == nil {
		invalidParams.Add(request.NewErrParamRequired("Id"))
	}

	if invalidParams.Len() > 0 {
		return invalidParams
	}
	return nil
}

// SetId sets the Id field's value.
func (s *GetEndpointCertificateInput) SetId(v string) *GetEndpointCertificateInput {
	s.Id = &v
	return s
}

type GetEndpointCertificateOutput struct {
	_ struct{} `type:"structure" json:",omitempty"`

	Metadata *response.ResponseMetadata

	NotAfter *int64 `type:"int64" json:",omitempty"`

	NotBefore *int64 `type:"int64" json:",omitempty"`

	PCAHost *string `type:"string" json:",omitempty"`

	PCAInstanceCertificate *string `type:"string" json:",omitempty"`

	PCAName *string `type:"string" json:",omitempty"`

	PCARootCACertificate *string `type:"string" json:",omitempty"`

	PCASubCACertificate *string `type:"string" json:",omitempty"`
}

// String returns the string representation
func (s GetEndpointCertificateOutput) String() string {
	return volcengineutil.Prettify(s)
}

// GoString returns the string representation
func (s GetEndpointCertificateOutput) GoString() string {
	return s.String()
}

// SetNotAfter sets the NotAfter field's value.
func (s *GetEndpointCertificateOutput) SetNotAfter(v int64) *GetEndpointCertificateOutput {
	s.NotAfter = &v
	return s
}

// SetNotBefore sets the NotBefore field's value.
func (s *GetEndpointCertificateOutput) SetNotBefore(v int64) *GetEndpointCertificateOutput {
	s.NotBefore = &v
	return s
}

// SetPCAHost sets the PCAHost field's value.
func (s *GetEndpointCertificateOutput) SetPCAHost(v string) *GetEndpointCertificateOutput {
	s.PCAHost = &v
	return s
}

// SetPCAInstanceCertificate sets the PCAInstanceCertificate field's value.
func (s *GetEndpointCertificateOutput) SetPCAInstanceCertificate(v string) *GetEndpointCertificateOutput {
	s.PCAInstanceCertificate = &v
	return s
}

// SetPCAName sets the PCAName field's value.
func (s *GetEndpointCertificateOutput) SetPCAName(v string) *GetEndpointCertificateOutput {
	s.PCAName = &v
	return s
}

// SetPCARootCACertificate sets the PCARootCACertificate field's value.
func (s *GetEndpointCertificateOutput) SetPCARootCACertificate(v string) *GetEndpointCertificateOutput {
	s.PCARootCACertificate = &v
	return s
}

// SetPCASubCACertificate sets the PCASubCACertificate field's value.
func (s *GetEndpointCertificateOutput) SetPCASubCACertificate(v string) *GetEndpointCertificateOutput {
	s.PCASubCACertificate = &v
	return s
}
