github.com/aiven/aiven-go-client@v1.36.0/transit_gateway_vpc_attachment.go (about)

     1  package aiven
     2  
     3  type (
     4  	// TransitGatewayVPCAttachmentHandler is the client that interacts with the
     5  	// Transit Gateway VPC Attachment API on Aiven.
     6  	TransitGatewayVPCAttachmentHandler struct {
     7  		client *Client
     8  	}
     9  
    10  	// TransitGatewayVPCAttachmentRequest holds the parameters to create a new
    11  	// or update an existing Transit Gateway VPC Attachment.
    12  	TransitGatewayVPCAttachmentRequest struct {
    13  		Add    []TransitGatewayVPCAttachment `json:"add"`
    14  		Delete []string                      `json:"delete"`
    15  	}
    16  
    17  	// TransitGatewayVPCAttachment represents Transit Gateway VPC Attachment
    18  	TransitGatewayVPCAttachment struct {
    19  		CIDR              string  `json:"cidr"`
    20  		PeerCloudAccount  string  `json:"peer_cloud_account"`
    21  		PeerResourceGroup *string `json:"peer_resource_group"`
    22  		PeerVPC           string  `json:"peer_vpc"`
    23  	}
    24  )
    25  
    26  // Update updates user-defined peer network CIDRs for a project VPC
    27  func (h *TransitGatewayVPCAttachmentHandler) Update(
    28  	project, projectVPCId string,
    29  	req TransitGatewayVPCAttachmentRequest,
    30  ) (*VPC, error) {
    31  	path := buildPath("project", project, "vpcs", projectVPCId, "user-peer-network-cidrs")
    32  	rsp, err := h.client.doPutRequest(path, req)
    33  	if err != nil {
    34  		return nil, err
    35  	}
    36  
    37  	return parseVPCResponse(rsp)
    38  }