Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR review for error messages #22

Open
wants to merge 8 commits into
base: eni
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions common/messages/messages_en.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,34 @@ var messagesEn = map[string]util.Message{
RC: 500,
Action: "Wait for file share deletion",
},
"ListSubnetsFailed": {
Code: "ListSubnetsFailed",
Description: "Unable to fetch list of subnet.",
Type: util.RetrivalFailed,
RC: 500,
Action: "Unable to list subnets. Target to appropriate region 'ibmcloud target -r <region>' and verify if 'ibmcloud is subnets' is returning the subnets. If it is not returning then raise ticket for VPC team else raise ticket for IKS team.",
},
"SubnetFindFailedWithZoneAndSubnetID": {
Code: "SubnetFindFailedWithZoneAndSubnetID",
Description: "A subnet with the specified zone '%s' and available cluster subnet list '%s' could not be found.",
Type: util.RetrivalFailed,
RC: 404,
Action: "Verify that the subnet from the cluster subnet list exists. Target to appropriate region 'ibmcloud target -r <region>' and verify if 'ibmcloud is subnets' is returning the subnets. If it is not returning the matching subnet from the cluster subnet list then raise ticket for VPC team else raise ticket for IKS team.",
},
"ListSecurityGroupsFailed": {
Code: "ListSecurityGroupsFailed",
Description: "Unable to fetch list of securityGroup.",
Type: util.RetrivalFailed,
RC: 500,
Action: "Unable to list securityGroup. Target to appropriate region 'ibmcloud target -r <region>' and verify if 'ibmcloud is securityGroups' is returning the securityGroups. If it is not returning then raise ticket for VPC team else raise ticket for IKS team.",
},
"SecurityGroupFindFailedWithVPCAndSecurityGroupName": {
Code: "SecurityGroupFindFailedWithVPCAndSecurityGroupName",
Description: "A securityGroup with the specified cluster securityGroup name '%s' could not be found.",
Type: util.RetrivalFailed,
RC: 404,
Action: "Verify that the cluster securityGroup exists. Target to appropriate region 'ibmcloud target -r <region>' and verify if 'ibmcloud is securityGroups' is returning the securityGroups. Please provide the output and raise ticket for IKS team.",
},
"ListVolumesFailed": {
Code: "ListVolumesFailed",
Description: "Unable to fetch list of file shares.",
Expand Down
5 changes: 1 addition & 4 deletions common/vpcclient/models/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ package models

const (
// APIVersion is the target RIaaS API spec version
APIVersion = "2023-05-30"
APIVersion = "2023-07-11"

// APIGeneration ...
APIGeneration = 1

// UserAgent identifies IKS to the RIaaS API
UserAgent = "IBM-Kubernetes-Service"

// MaturityBeta flag
MaturityBeta = "beta"
)
41 changes: 41 additions & 0 deletions common/vpcclient/models/security_group.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*******************************************************************************
* IBM Confidential
* OCO Source Materials
* IBM Cloud Kubernetes Service, 5737-D43
* (C) Copyright IBM Corp. 2023 All Rights Reserved.
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with
* the U.S. Copyright Office.
******************************************************************************/

// Package models ...
package models

import (
"github.com/IBM/ibmcloud-volume-interface/lib/provider"
)

// SecurityGroup ...
type SecurityGroup struct {
CRN string `json:"crn,omitempty"`
Href string `json:"href,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
ResourceGroup *ResourceGroup `json:"resource_group,omitempty"`
VPC *provider.VPC `json:"vpc,omitempty"`
}

// SecurityGroupList ...
type SecurityGroupList struct {
First *HReference `json:"first,omitempty"`
Next *HReference `json:"next,omitempty"`
SecurityGroups []SecurityGroup `json:"security_groups,omitempty"`
Limit int `json:"limit,omitempty"`
TotalCount int `json:"total_count,omitempty"`
}

// ListSecurityGroupFilters ...
type ListSecurityGroupFilters struct {
ResourceGroupID string `json:"resource_group.id,omitempty"`
VPCID string `json:"vpc.id,omitempty"`
}
7 changes: 4 additions & 3 deletions common/vpcclient/models/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ type Share struct {
Profile *Profile `json:"profile,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
// Status of share named - deleted, deleting, failed, pending, stable, updating, waiting, suspended
Status StatusType `json:"lifecycle_state,omitempty"`
ShareTargets *[]ShareTarget `json:"mount_targets,omitempty"`
Zone *Zone `json:"zone,omitempty"`
Status StatusType `json:"lifecycle_state,omitempty"`
ShareTargets *[]ShareTarget `json:"mount_targets,omitempty"`
Zone *Zone `json:"zone,omitempty"`
AccessControlMode string `json:"access_control_mode,omitempty"`
}

// ListShareTargerFilters ...
Expand Down
12 changes: 12 additions & 0 deletions common/vpcclient/models/share_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ type ShareTarget struct {
// Status of share target named - deleted, deleting, failed, pending, stable, updating, waiting, suspended
Status string `json:"lifecycle_state,omitempty"`
VPC *provider.VPC `json:"vpc,omitempty"`
//EncryptionInTransit
EncryptionInTransit string `json:"transit_encryption,omitempty"`
VirtualNetworkInterface *VirtualNetworkInterface `json:"virtual_network_interface,omitempty"`
//Share ID this target is associated to
ShareID string `json:"-"`
Zone *Zone `json:"zone,omitempty"`
Expand All @@ -47,6 +50,15 @@ type ShareTargetList struct {
TotalCount int `json:"total_count,omitempty"`
}

// VirtualNetworkInterface
type VirtualNetworkInterface struct {
Name string `json:"name,omitempty"`
Subnet *SubnetRef `json:"subnet,omitempty"`
SecurityGroups *[]provider.SecurityGroup `json:"security_groups,omitempty"`
PrimaryIP *provider.PrimaryIP `json:"primary_ip,omitempty"`
ResourceGroup *provider.ResourceGroup `json:"resource_group,omitempty"`
}

// NewShareTarget creates ShareTarget from VolumeAccessPointRequest
func NewShareTarget(volumeAccessPointRequest provider.VolumeAccessPointRequest) ShareTarget {
va := ShareTarget{
Expand Down
50 changes: 50 additions & 0 deletions common/vpcclient/models/subnet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*******************************************************************************
* IBM Confidential
* OCO Source Materials
* IBM Cloud Kubernetes Service, 5737-D43
* (C) Copyright IBM Corp. 2023 All Rights Reserved.
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with
* the U.S. Copyright Office.
******************************************************************************/

// Package models ...
package models

import (
"github.com/IBM/ibmcloud-volume-interface/lib/provider"
)

// Subnet ...
type Subnet struct {
CRN string `json:"crn,omitempty"`
Href string `json:"href,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
ResourceGroup *ResourceGroup `json:"resource_group,omitempty"`
VPC *provider.VPC `json:"vpc,omitempty"`
Zone *Zone `json:"zone,omitempty"`
}

// SubnetRef ...
type SubnetRef struct {
CRN string `json:"crn,omitempty"`
ID string `json:"id,omitempty"`
Href string `json:"href,omitempty"`
}

// SubnetList ...
type SubnetList struct {
First *HReference `json:"first,omitempty"`
Next *HReference `json:"next,omitempty"`
Subnets []Subnet `json:"subnets,omitempty"`
Limit int `json:"limit,omitempty"`
TotalCount int `json:"total_count,omitempty"`
}

// ListSubnetFilters ...
type ListSubnetFilters struct {
ResourceGroupID string `json:"resource_group.id,omitempty"`
VPCID string `json:"vpc.id,omitempty"`
ZoneName string `json:"zone.name,omitempty"`
}
1 change: 0 additions & 1 deletion common/vpcclient/riaas/riaas.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func New(config Config) (*Session, error) {
queryValues := url.Values{
"version": []string{backendAPIVersion},
"generation": []string{strconv.Itoa(apiGen)},
"maturity": []string{models.MaturityBeta},
}

riaasClient := client.New(ctx, config.baseURL(), queryValues, config.httpClient(), config.ContextID, config.ResourceGroup)
Expand Down
2 changes: 2 additions & 0 deletions common/vpcclient/vpcfilevolume/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ const (
shareTargetsPath = "/mount_targets"
shareTargetIDParam = "target-id"
shareTargetIDPath = shareTargetsPath + "/{" + shareTargetIDParam + "}"
subnets = Version + "/subnets"
securityGroups = Version + "/security_groups"
)
170 changes: 170 additions & 0 deletions common/vpcclient/vpcfilevolume/fakes/share.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading