diff --git a/loadbalancer_member.go b/loadbalancer_member.go index 246f921..ffa24ac 100644 --- a/loadbalancer_member.go +++ b/loadbalancer_member.go @@ -17,7 +17,7 @@ type CloudLoadBalancerMemberService interface { Get(ctx context.Context, poolID, id string) (*CloudLoadBalancerMember, error) Update(ctx context.Context, poolID, id string, req *CloudLoadBalancerMemberUpdateRequest) (*CloudLoadBalancerMember, error) Delete(ctx context.Context, poolID, id string) error - Create(ctx context.Context, poolID string, req *CloudLoadBalancerCreateRequest) (*CloudLoadBalancerMember, error) + Create(ctx context.Context, poolID string, req *CloudLoadBalancerMemberCreateRequest) (*CloudLoadBalancerMember, error) BatchUpdate(ctx context.Context, poolID string, members *CloudLoadBalancerBatchMemberUpdateRequest) error } @@ -42,8 +42,8 @@ type CloudLoadBalancerBatchMemberUpdateRequest struct { Members []CloudLoadBalancerExtendMemberUpdateRequest `json:"members"` } -// CloudLoadBalancerCreateRequest represents create member request payload -type CloudLoadBalancerCreateRequest struct { +// CloudLoadBalancerMemberCreateRequest represents create member request payload +type CloudLoadBalancerMemberCreateRequest struct { Name string `json:"name"` Weight int `json:"weight,omitempty"` Address string `json:"address"` @@ -187,9 +187,9 @@ func (m *cloudLoadBalancerMemberResource) Delete(ctx context.Context, poolID, id } // Create - Create a new member -func (m *cloudLoadBalancerMemberResource) Create(ctx context.Context, poolID string, mcr *CloudLoadBalancerCreateRequest) (*CloudLoadBalancerMember, error) { +func (m *cloudLoadBalancerMemberResource) Create(ctx context.Context, poolID string, mcr *CloudLoadBalancerMemberCreateRequest) (*CloudLoadBalancerMember, error) { var data struct { - CloudLoadBalancerMember *CloudLoadBalancerCreateRequest `json:"member"` + CloudLoadBalancerMember *CloudLoadBalancerMemberCreateRequest `json:"member"` } data.CloudLoadBalancerMember = mcr req, err := m.client.NewRequest(ctx, http.MethodPost, loadBalancerServiceName, m.resourcePath(poolID), &data) diff --git a/loadbalancer_pool.go b/loadbalancer_pool.go index 664562d..3d427ee 100644 --- a/loadbalancer_pool.go +++ b/loadbalancer_pool.go @@ -53,46 +53,46 @@ type CloudLoadBalancerPoolMemberRequest struct { // CloudLoadBalancerPoolCreateRequest represents create new pool request payload. type CloudLoadBalancerPoolCreateRequest struct { - LBAlgorithm string `json:"lb_algorithm"` - ListenerID string `json:"listener_id,omitempty"` - Name *string `json:"name,omitempty"` - Protocol string `json:"protocol"` - SessionPersistence *SessionPersistence `json:"session_persistence,omitempty"` - CloudLoadBalancerHealthMonitor *CloudLoadBalancerPoolHealthMonitorRequest `json:"healthmonitor,omitempty"` - Members []CloudLoadBalancerPoolMemberRequest `json:"members,omitempty"` + LBAlgorithm string `json:"lb_algorithm"` + ListenerID string `json:"listener_id,omitempty"` + Name *string `json:"name,omitempty"` + Protocol string `json:"protocol"` + SessionPersistence *SessionPersistence `json:"session_persistence,omitempty"` + HealthMonitor *CloudLoadBalancerPoolHealthMonitorRequest `json:"healthmonitor,omitempty"` + Members []CloudLoadBalancerPoolMemberRequest `json:"members,omitempty"` } // CloudLoadBalancerPoolUpdateRequest represents update pool request payload. type CloudLoadBalancerPoolUpdateRequest struct { - AdminStateUp *bool `json:"admin_state_up,omitempty"` - Description *string `json:"description,omitempty"` - LBAlgorithm *string `json:"lb_algorithm,omitempty"` - Name *string `json:"name,omitempty"` - SessionPersistence *SessionPersistence `json:"session_persistence"` - Members []CloudLoadBalancerPoolMemberRequest `json:"members,omitempty"` - CloudLoadBalancerHealthMonitor *CloudLoadBalancerPoolHealthMonitorRequest `json:"healthmonitor,omitempty"` + AdminStateUp *bool `json:"admin_state_up,omitempty"` + Description *string `json:"description,omitempty"` + LBAlgorithm *string `json:"lb_algorithm,omitempty"` + Name *string `json:"name,omitempty"` + SessionPersistence *SessionPersistence `json:"session_persistence"` + Members []CloudLoadBalancerPoolMemberRequest `json:"members,omitempty"` + HealthMonitor *CloudLoadBalancerPoolHealthMonitorRequest `json:"healthmonitor,omitempty"` } // CloudLoadBalancerPool contains pool information. type CloudLoadBalancerPool struct { - ID string `json:"id"` - TenandID string `json:"tenant_id"` - Description string `json:"description"` - LBAlgorithm string `json:"lb_algorithm"` - Name string `json:"name"` - CloudLoadBalancerHealthMonitor *CloudLoadBalancerHealthMonitor `json:"healthmonitor"` - UpdatedAt string `json:"updated_at"` - OperatingStatus string `json:"operating_status"` - Listeners []resourceID `json:"listeners"` - SessionPersistence *SessionPersistence `json:"session_persistence"` - ProvisoningStatus string `json:"provisioning_status"` - ProjectID string `json:"project_id"` - LoadBalancers []resourceID `json:"loadbalancers"` - AdminStateUp bool `json:"admin_state_up"` - Protocol string `json:"protocol"` - CreatedAt string `json:"created_at"` - HealthMonitorID string `json:"healthmonitor_id"` - Members []CloudLoadBalancerMember `json:"members"` + ID string `json:"id"` + TenandID string `json:"tenant_id"` + Description string `json:"description"` + LBAlgorithm string `json:"lb_algorithm"` + Name string `json:"name"` + HealthMonitor *CloudLoadBalancerHealthMonitor `json:"healthmonitor"` + UpdatedAt string `json:"updated_at"` + OperatingStatus string `json:"operating_status"` + Listeners []resourceID `json:"listeners"` + SessionPersistence *SessionPersistence `json:"session_persistence"` + ProvisoningStatus string `json:"provisioning_status"` + ProjectID string `json:"project_id"` + LoadBalancers []resourceID `json:"loadbalancers"` + AdminStateUp bool `json:"admin_state_up"` + Protocol string `json:"protocol"` + CreatedAt string `json:"created_at"` + HealthMonitorID string `json:"healthmonitor_id"` + Members []CloudLoadBalancerMember `json:"members"` } type cloudLoadBalancerPoolResource struct {