| @@ -288,6 +288,42 @@ service pcm { | |||||
| post /vm/createImage (CreateImageReq) returns (CreateImageResp) | post /vm/createImage (CreateImageReq) returns (CreateImageResp) | ||||
| @handler UploadImageHandler | @handler UploadImageHandler | ||||
| put /vm/uploadImage (UploadOsImageReq) returns (UploadOsImageResp) | put /vm/uploadImage (UploadOsImageReq) returns (UploadOsImageResp) | ||||
| @handler GetServersDetailedByIdHandler | |||||
| get /vm/getServersDetailedById (GetServersDetailedByIdReq) returns (GetServersDetailedByIdResp) | |||||
| @handler UpdateServerHandler | |||||
| put /vm/updateServer (UpdateServerReq) returns (UpdateServerResp) | |||||
| @handler StartServerHandler | |||||
| post /vm/startServer (StartServerReq) returns (StartServerResp) | |||||
| @handler StopServerHandler | |||||
| post /vm/stopServer (StopServerReq) returns (StopServerResp) | |||||
| @handler RebootServerHandler | |||||
| post /vm/rebootServer (RebootServerReq) returns (RebootServerResp) | |||||
| @handler PauseServerHandler | |||||
| post /vm/pauseServer (PauseServerReq) returns (PauseServerResp) | |||||
| @handler ShowNetworkDetailsHandler | |||||
| get /vm/showNetworkDetails (ShowNetworkDetailsReq) returns (ShowNetworkDetailsResp) | |||||
| @handler UpdateNetworkHandler | |||||
| put /vm/updateNetwork (UpdateNetworkReq) returns (UpdateNetworkResp) | |||||
| @handler BulkCreateNetworksHandler | |||||
| post /vm/bulkCreateNetworks (BulkCreateNetworksReq) returns (BulkCreateNetworksResp) | |||||
| @handler UpdateVolumeHandler | |||||
| put /vm/updateVolume (UpdateVolumeReq) returns (UpdateVolumeResp) | |||||
| @handler CreateVolumeTypesHandler | |||||
| post /vm/createVolumeTypes (CreateVolumeTypeReq) returns (CreateVolumeTypeResp) | |||||
| @handler DeleteVolumeTypeHandler | |||||
| delete /vm/deleteVolumeType (DeleteVolumeTypeReq) returns (DeleteVolumeTypeResp) | |||||
| @handler ListVolumesHandler | |||||
| get /vm/listVolumes (ListVolumesReq) returns (ListVolumesResp) | |||||
| // Bare Metal | |||||
| @handler ListNodesHandler | |||||
| get /vm/listNodes (ListNodesReq) returns (ListNodesResp) | |||||
| @handler CreateNodeHandler | |||||
| post /vm/createNode (CreateNodeReq) returns (CreateNodeResp) | |||||
| @handler DeleteNodeHandler | |||||
| delete /vm/deleteNode (DeleteNodeReq) returns (DeleteNodeResp) | |||||
| @handler ShowNodeDetailsHandler | |||||
| delete /vm/showNodeDetails (ShowNodeDetailsReq) returns (ShowNodeDetailsResp) | |||||
| } | } | ||||
| //存算联动 接口 | //存算联动 接口 | ||||
| @@ -135,6 +135,160 @@ type ( | |||||
| } | } | ||||
| ) | ) | ||||
| type( | |||||
| GetServersDetailedByIdReq{ | |||||
| ServerId string `form:"server_id" copier:"ServerId"` | |||||
| } | |||||
| GetServersDetailedByIdResp{ | |||||
| Servers ServersDetaileResp `json:"server" copier:"Servers"` | |||||
| Code int32 `json:"code,omitempty"` | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| } | |||||
| ServersDetaileResp { | |||||
| AccessIPv4 string `json:"accessIPv4" copier:"AccessIPv4"` | |||||
| AccessIPv6 string `json:"accessIPv6" copier:"AccessIPv6"` | |||||
| Addresses Addresses `json:"addresses" copier:"Addresses"` | |||||
| Name string `json:"name" copier:"Name"` | |||||
| ConfigDrive string `json:"config_drive" copier:"ConfigDrive"` | |||||
| Created string `json:"created" copier:"Created"` | |||||
| Flavor FlavorDetailed `json:"flavor" copier:"Flavor"` | |||||
| HostId string `json:"hostId" copier:"HostId"` | |||||
| Id string `json:"id" copier:"Id"` | |||||
| Image ImageDetailed `json:"image" copier:"Image"` | |||||
| KeyName string `json:"key_name" copier:"KeyName"` | |||||
| Links1 []Links1 `json:"links" copier:"Links1"` | |||||
| Metadata MetadataDetailed `json:"metadata" copier:"Metadata"` | |||||
| Status string `json:"status" copier:"Status"` | |||||
| TenantId string `json:"tenant_id" copier:"TenantId"` | |||||
| Updated string `json:"updated" copier:"Updated"` | |||||
| UserId string `json:"user_id" copier:"UserId"` | |||||
| Fault Fault `json:"fault" copier:"Fault"` | |||||
| Progress uint32 `json:"progress" copier:"Progress"` | |||||
| Locked bool `json:"locked" copier:"Locked"` | |||||
| HostStatus string `json:"host_status" copier:"HostStatus"` | |||||
| Description string `json:"description" copier:"Description"` | |||||
| Tags []string `json:"tags" copier:"Tags"` | |||||
| TrustedImageCertificates string `json:"trusted_image_certificates" copier:"TrustedImageCertificates"` | |||||
| ServerGroups string `json:"server_groups" copier:"ServerGroups"` | |||||
| LockedReason string `json:"locked_reason" copier:"LockedReason"` | |||||
| SecurityGroups []Security_groups `json:"security_groups" copier:"SecurityGroups"` | |||||
| } | |||||
| Addresses { | |||||
| private Private `json:"private" copier:"private"` | |||||
| } | |||||
| FlavorDetailed { | |||||
| Id string `json:"id" copier:"Id"` | |||||
| Links string `json:"links" copier:"Links"` | |||||
| Vcpus string `json:"vcpus" copier:"Vcpus"` | |||||
| Ram uint32 `json:"ram" copier:"Ram"` | |||||
| Disk uint32 `json:"ram" copier:"Disk"` | |||||
| Dphemeral uint32 `json:"ephemeral" copier:"Dphemeral"` | |||||
| Swap uint32 `json:"swap" copier:"Swap"` | |||||
| OriginalName string `json:"OriginalName" copier:"OriginalName"` | |||||
| ExtraSpecs ExtraSpecs `json:"Extra_specs" copier:"ExtraSpecs"` | |||||
| } | |||||
| Links1{ | |||||
| Href string `json:"href " copier:"Href"` | |||||
| Rel string `json:"rel" copier:"Rel"` | |||||
| } | |||||
| ImageDetailed{ | |||||
| Id string `json:"id " copier:"Id"` | |||||
| Links []Links `json:"links" copier:"Links"` | |||||
| } | |||||
| MetadataDetailed{ | |||||
| } | |||||
| Fault{ | |||||
| Code uint32 `json:"code " copier:"Code"` | |||||
| Created string `json:"created " copier:"Created"` | |||||
| Message string `json:"message " copier:"Message"` | |||||
| Details string `json:"details " copier:"Details"` | |||||
| } | |||||
| Private{ | |||||
| Addr string `json:"addr" copier:"Addr"` | |||||
| Version uint32 `json:"version" copier:"Version"` | |||||
| } | |||||
| ExtraSpecs{ | |||||
| Capabilities string `json:"capabilities" copier:"Capabilities"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| UpdateServerReq{ | |||||
| ServerId string `json:"server_id" copier:"ServerId"` | |||||
| Server Server `json:"server" copier:"Server"` | |||||
| } | |||||
| UpdateServerResp{ | |||||
| Code int32 `json:"code,omitempty"` | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| Server ServersDetaileResp `json:"server" copier:"Server"` | |||||
| } | |||||
| ) | |||||
| type ( | |||||
| StartServerReq { | |||||
| ServerId string `json:"server_id" copier:"ServerId"` | |||||
| OsStart OsStart `json:"osStart" copier:"OsStart"` | |||||
| } | |||||
| StartServerResp { | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| Code int32 `json:"code,omitempty"` | |||||
| } | |||||
| OsStart { | |||||
| os_start string `json:"os_start" copier:"os_start"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| StopServerReq{ | |||||
| ServerId string `json:"server_id" copier:"ServerId"` | |||||
| OsStart OsStart `json:"os_start" copier:"OsStart"` | |||||
| } | |||||
| StopServerResp { | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| Code int32 `json:"code,omitempty"` } | |||||
| OsStop { | |||||
| OsStop string `json:"os_stop" copier:"OsStop"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| RebootServerReq{ | |||||
| ServerId string `json:"server_id" copier:"ServerId"` | |||||
| OsStart OsStart `json:"os_start" copier:"OsStart"` | |||||
| } | |||||
| RebootServerResp { | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| Code int32 `json:"code,omitempty"` | |||||
| } | |||||
| Reboot { | |||||
| Type string `json:"type" copier:"Type"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| PauseServerReq{ | |||||
| ServerId string `json:"server_id" copier:"ServerId"` | |||||
| OsStart OsStart `json:"os_start" copier:"OsStart"` | |||||
| } | |||||
| PauseServerResp { | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| Code int32 `json:"code,omitempty"` | |||||
| } | |||||
| OsPause { | |||||
| Pause string `json:"pause" copier:"Pause"` | |||||
| } | |||||
| ) | |||||
| type ( | type ( | ||||
| DeleteServerReq { | DeleteServerReq { | ||||
| ServerId string `form:"server_id" copier:"ServerId"` | ServerId string `form:"server_id" copier:"ServerId"` | ||||
| @@ -414,6 +568,73 @@ type ( | |||||
| End string `json:"end" copier:"End"` | End string `json:"end" copier:"End"` | ||||
| } | } | ||||
| ) | ) | ||||
| type( | |||||
| ShowNetworkDetailsReq{ | |||||
| NetworkId string `json:"network_id" copier:"NetworkId"` | |||||
| Fields string `json:"fields" copier:"Fields"` | |||||
| } | |||||
| ShowNetworkDetailsResp{ | |||||
| Network Networkdetail `json:"network" copier:"Network"` | |||||
| msg string `json:"msg" copier:"msg"` | |||||
| code int32 `json:"code" copier:"code"` | |||||
| ErrorMsg string `json:"error_msg" copier:"ErrorMsg"` | |||||
| } | |||||
| Networkdetail { | |||||
| AdminStateUp bool `json:"admin_state_up" copier:"AdminStateUp"` | |||||
| AvailabilityZoneHints []string `json:"availability_zone_hints" copier:"AvailabilityZoneHints"` | |||||
| AvailabilityZones []string `json:"availability_zones" copier:"AvailabilityZones"` | |||||
| CreatedAt string `json:"created_at" copier:"CreatedAt"` | |||||
| DnsDomain string `json:"dns_domain" copier:"DnsDomain"` | |||||
| Id string `json:"id" copier:"Id"` | |||||
| Ipv4AddressScope string `json:"ipv4_address_scope" copier:"Ipv4AddressScope"` | |||||
| Ipv6AddressScope string `json:"ipv6_address_scope" copier:"Ipv6AddressScope"` | |||||
| L2Adjacency bool `json:"l2_adjacency" copier:"L2Adjacency"` | |||||
| Mtu string `json:"mtu" copier:"Mtu"` | |||||
| Name string `json:"name" copier:"Name"` | |||||
| PortSecurityEnabled string `json:"port_security_enabled" copier:"PortSecurityEnabled"` | |||||
| ProjectId string `json:"project_id" copier:"ProjectId"` | |||||
| ProviderNetworkType string `json:"provider_network_type" copier:"ProviderNetworkType"` | |||||
| QosPolicyId string `json:"qos_policy_id" copier:"QosPolicyId"` | |||||
| RevisionNumber string `json:"revision_number" copier:"RevisionNumber"` | |||||
| Segments Segment `json:"segments" copier:"Segment"` | |||||
| Shared bool `json:"shared" copier:"Shared"` | |||||
| Status bool `json:"status" copier:"Status"` | |||||
| Subnets []bool `json:"subnets" copier:"Subnets"` | |||||
| TenantId string `json:"tenant_id" copier:"TenantId"` | |||||
| VlanTransparent bool `json:"vlan_transparent" copier:"VlanTransparent"` | |||||
| Description string `json:"description" copier:"Description"` | |||||
| IsDefault bool `json:"is_default" copier:"IsDefault"` | |||||
| Tags string `json:"tags" copier:"Tags"` | |||||
| } | |||||
| Segment{ | |||||
| } | |||||
| ) | |||||
| type( | |||||
| UpdateNetworkReq { | |||||
| NetworkId string `json:"network_id" copier:"NetworkId"` | |||||
| } | |||||
| UpdateNetworkResp { | |||||
| Network Networkdetail `json:"network" copier:"Network"` | |||||
| msg string `json:"msg" copier:"msg"` | |||||
| code int32 `json:"code" copier:"code"` | |||||
| ErrorMsg string `json:"error_msg" copier:"ErrorMsg"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| BulkCreateNetworksReq { | |||||
| Network []CreateNetwork `json:"network" copier:"Network"` | |||||
| } | |||||
| BulkCreateNetworksResp { | |||||
| Network []Network `json:"network" copier:"Network"` | |||||
| Code int32 `json:"code,omitempty" copier:"Code"` | |||||
| Msg string `json:"msg,omitempty" copier:"Msg"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty" copier:"ErrorMsg"` | |||||
| } | |||||
| ) | |||||
| /******************find Networks end*************************/ | /******************find Networks end*************************/ | ||||
| /******************find ListVolumesDetail start*************************/ | /******************find ListVolumesDetail start*************************/ | ||||
| @@ -452,8 +673,8 @@ type ( | |||||
| type ( | type ( | ||||
| DeleteVolumeReq { | DeleteVolumeReq { | ||||
| VolumeId string `form:"volume_id" copier:"VolumeId"` | VolumeId string `form:"volume_id" copier:"VolumeId"` | ||||
| cascade bool `json:"cascade" copier:"cascade"` | |||||
| force bool `json:"force" copier:"force"` | |||||
| Cascade bool `json:"cascade" copier:"Cascade"` | |||||
| Force bool `json:"force" copier:"force"` | |||||
| } | } | ||||
| DeleteVolumeResp { | DeleteVolumeResp { | ||||
| Code int32 `json:"code,omitempty" copier:"Code"` | Code int32 `json:"code,omitempty" copier:"Code"` | ||||
| @@ -525,6 +746,75 @@ type ( | |||||
| } | } | ||||
| ) | ) | ||||
| type( | |||||
| UpdateVolumeReq { | |||||
| Volume Volume `json:"volume" copier:"Volume"` | |||||
| VolumeTypeId string `json:"volume_type_id" copier:"VolumeTypeId"` | |||||
| } | |||||
| UpdateVolumeResp { | |||||
| Volume Volume `json:"volume" copier:"Volume"` | |||||
| Code int32 `json:"code,omitempty" copier:"Code"` | |||||
| Msg string `json:"msg,omitempty" copier:"Msg"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty" copier:"ErrorMsg"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| CreateVolumeTypeReq { | |||||
| VolumeType VolumeType `json:"volume_type" copier:"VolumeType"` | |||||
| } | |||||
| CreateVolumeTypeResp { | |||||
| VolumeType VolumeType `json:"volume_type" copier:"VolumeType"` | |||||
| Code int32 `json:"code,omitempty" copier:"Code"` | |||||
| Msg string `json:"msg,omitempty" copier:"Msg"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty" copier:"ErrorMsg"` | |||||
| } | |||||
| VolumeType { | |||||
| VolumeType string `json:"Volume_type" copier:"VolumeType"` | |||||
| Description string `json:"description" copier:"Description"` | |||||
| ExtraSpecs ExtraSpecs `json:"extra_specs" copier:"ExtraSpecs"` | |||||
| Id string `json:"id" copier:"Id"` | |||||
| IsPublic bool `json:"is_public" copier:"IsPublic"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| DeleteVolumeTypeReq { | |||||
| VolumeTypeId string `json:"volume_type_id" copier:"VolumeTypeId"` | |||||
| } | |||||
| DeleteVolumeTypeResp { | |||||
| Code int32 `json:"code,omitempty" copier:"Code"` | |||||
| Msg string `json:"msg,omitempty" copier:"Msg"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty" copier:"ErrorMsg"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| ListVolumesReq { | |||||
| ProjectId string `json:"project_id" copier:"ProjectId"` | |||||
| AllTenants string `json:"all_tenants" copier:"AllTenants"` | |||||
| Sort string `json:"sort" copier:"Sort"` | |||||
| Limit int32 `json:"limit" copier:"Limit"` | |||||
| Offset int32 `json:"offset" copier:"Offset"` | |||||
| Marker string `json:"marker" copier:"Marker"` | |||||
| WithCount bool `json:"with_count" copier:"WithCount"` | |||||
| CreatedAt string `json:"created_at" copier:"CreatedAt"` | |||||
| ConsumesQuota bool `json:"consumes_quota" copier:"ConsumesQuota"` | |||||
| UpdatedAt string `json:"updated_at" copier:"UpdatedAt"` | |||||
| } | |||||
| ListVolumesResp { | |||||
| Volumes []VolumesList `json:"volumes" copier:"Volumes"` | |||||
| Code int32 `json:"code,omitempty" copier:"Code"` | |||||
| Msg string `json:"msg,omitempty" copier:"Msg"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty" copier:"ErrorMsg"` | |||||
| } | |||||
| VolumesList { | |||||
| Id string `json:"id" copier:"Id"` | |||||
| Links Links `json:"links" copier:"Links"` | |||||
| Name string `json:"name" copier:"Name"` | |||||
| } | |||||
| ) | |||||
| /******************find ListVolumesDetail end*************************/ | /******************find ListVolumesDetail end*************************/ | ||||
| type ( | type ( | ||||
| @@ -551,4 +841,282 @@ type ( | |||||
| rxtx_factor float32 `json:"rxtx_factor" copier:"rxtx_factor"` | rxtx_factor float32 `json:"rxtx_factor" copier:"rxtx_factor"` | ||||
| os_flavor_access_is_public bool `json:"os_flavor_access_is_public" copier:"os_flavor_access_is_public"` | os_flavor_access_is_public bool `json:"os_flavor_access_is_public" copier:"os_flavor_access_is_public"` | ||||
| } | } | ||||
| ) | |||||
| ) | |||||
| /******************Bare Metal start*************************/ | |||||
| type( | |||||
| ListNodesReq { | |||||
| Limit int64 `json:"limit" copier:"Limit"` | |||||
| Marker string `json:"marker" copier:"Marker"` | |||||
| SortDir string `json:"sort_dir" copier:"SortDir"` | |||||
| SortKey string `json:"sort_key" copier:"SortKey"` | |||||
| InstanceUuid string `json:"instance_uuid" copier:"InstanceUuid"` | |||||
| Maintenance bool `json:"maintenance" copier:"Maintenance"` | |||||
| Associated bool `json:"associated" copier:"Associated"` | |||||
| ProvisionState string `json:"provision_state" copier:"ProvisionState"` | |||||
| Sharded bool `json:"sharded" copier:"Sharded"` | |||||
| Driver string `json:"driver" copier:"Driver"` | |||||
| ResourceClass string `json:"resource_class" copier:"ResourceClass"` | |||||
| ConductorGroup string `json:"conductor_group" copier:"ConductorGroup"` | |||||
| Conductor string `json:"conductor" copier:"Conductor"` | |||||
| Fault string `json:"fault" copier:"Fault"` | |||||
| Owner string `json:"owner" copier:"Owner"` | |||||
| Lessee string `json:"lessee" copier:"Lessee"` | |||||
| Shard []string `json:"shard" copier:"Shard"` | |||||
| Detail bool `json:"detail" copier:"Detail"` | |||||
| ParentNode string `json:"parent_node" copier:"ParentNode"` | |||||
| IncludeChildren string `json:"include_children" copier:"IncludeChildren"` | |||||
| } | |||||
| ListNodesResp { | |||||
| Nodes []Nodes `json:"nodes" copier:"Nodes"` | |||||
| Code int32 `json:"code,omitempty"` | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| } | |||||
| Nodes { | |||||
| InstanceUuid string `json:"instance_uuid" copier:"InstanceUuid"` | |||||
| Links []Links `json:"links" copier:"Links"` | |||||
| Maintenance bool `json:"maintenance" copier:"Maintenance"` | |||||
| Name string `json:"name" copier:"Name"` | |||||
| PowerState string `json:"name" copier:"PowerState"` | |||||
| ProvisionState string `json:"provision_state" copier:"ProvisionState"` | |||||
| Uuid string `json:"uuid" copier:"Uuid"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| CreateNodeReq { | |||||
| Name string `json:"name" copier:"Name"` | |||||
| Driver string `json:"driver" copier:"Driver"` | |||||
| DriverInfo DriverInfo `json:"driver_info" copier:"DriverInfo"` | |||||
| ResourceClass string `json:"resource_class" copier:"ResourceClass"` | |||||
| BootInterface string `json:"boot_interface" copier:"BootInterface"` | |||||
| ConductorGroup string `json:"conductor_group" copier:"ConductorGroup"` | |||||
| ConsoleInterface string `json:"console_interface" copier:"ConsoleInterface"` | |||||
| DeployInterface string `json:"deploy_interface" copier:"DeployInterface"` | |||||
| InspectInterface string `json:"inspect_interface" copier:"InspectInterface"` | |||||
| ManagementInterface string `json:"inspect_interface" copier:"ManagementInterface"` | |||||
| NetworkInterface string `json:"network_interface" copier:"NetworkInterface"` | |||||
| RescueInterface string `json:"rescue_interface" copier:"RescueInterface"` | |||||
| StorageInterface string `json:"storage_interface" copier:"StorageInterface"` | |||||
| Uuid string `json:"uuid" copier:"Uuid"` | |||||
| VendorInterface string `json:"vendor_interface" copier:"VendorInterface"` | |||||
| Owner string `json:"owner" copier:"Owner"` | |||||
| Description string `json:"description" copier:"Description"` | |||||
| Lessee string `json:"lessee" copier:"Lessee"` | |||||
| Shard string `json:"shard" copier:"Shard"` | |||||
| Properties Properties `json:"properties" copier:"Properties"` | |||||
| AutomatedClean bool `json:"automated_clean" copier:"AutomatedClean"` | |||||
| BiosInterface string `json:"bios_interface" copier:"BiosInterface"` | |||||
| ChassisUuid string `json:"chassis_uuid" copier:"ChassisUuid"` | |||||
| InstanceUuid string `json:"instance_uuid" copier:"InstanceUuid"` | |||||
| Maintenance bool `json:"maintenance" copier:"Maintenance"` | |||||
| MaintenanceReason bool `json:"maintenance_reason" copier:"MaintenanceReason"` | |||||
| NetworkData NetworkData `json:"network_data" copier:"NetworkData"` | |||||
| Protected bool `json:"protected" copier:"Protected"` | |||||
| ProtectedReason string `json:"protected_reason" copier:"ProtectedReason"` | |||||
| Retired bool `json:"retired" copier:"Retired"` | |||||
| RetiredReason string `json:"retired_reason" copier:"RetiredReason"` | |||||
| } | |||||
| DriverInfo{ | |||||
| } | |||||
| Properties{ | |||||
| } | |||||
| NetworkData{ | |||||
| } | |||||
| CreateNodeResp { | |||||
| AllocationUuid string `json:"allocation_uuid" copier:"AllocationUuid"` | |||||
| Name string `json:"name" copier:"name"` | |||||
| PowerState string `json:"power_state" copier:"PowerState"` | |||||
| TargetPowerState string `json:"target_power_state" copier:"TargetPowerState"` | |||||
| ProvisionState string `json:"provision_state" copier:"ProvisionState"` | |||||
| TargetProvisionState string `json:"target_provision_state" copier:"TargetProvisionState"` | |||||
| Maintenance bool `json:"maintenance" copier:"Maintenance"` | |||||
| MaintenanceReason string `json:"maintenance_reason" copier:"MaintenanceReason"` | |||||
| Fault string `json:"fault" copier:"Fault"` | |||||
| LastError string `json:"last_error" copier:"LastError"` | |||||
| Reservation string `json:"reservation" copier:"Reservation"` | |||||
| Driver string `json:"driver" copier:"Driver"` | |||||
| DriverInfo Driver_info `json:"driver_info" copier:"DriverInfo"` | |||||
| DriverInternalInfo DriverInternalInfo `json:"driver_internal_info" copier:"DriverInternalInfo"` | |||||
| Properties Properties `json:"properties" copier:"Properties"` | |||||
| InstanceInfo InstanceInfo `json:"instance_info" copier:"InstanceInfo"` | |||||
| InstanceUuid string `json:"instance_uuid" copier:"InstanceUuid"` | |||||
| ChassisUuid string `json:"chassis_uuid" copier:"ChassisUuid"` | |||||
| Extra Extra `json:"extra" copier:"Extra"` | |||||
| ConsoleEnabled bool `json:"console_enabled" copier:"ConsoleEnabled"` | |||||
| RaidConfig RaidConfig `json:"raid_config" copier:"RaidConfig"` | |||||
| TargetRaidConfig TargetRaidConfig `json:"target_raid_config" copier:"TargetRaidConfig"` | |||||
| CleanStep CleanStep `json:"clean_step" copier:"CleanStep"` | |||||
| DeployStep DeployStep `json:"clean_step" copier:"DeployStep"` | |||||
| Links []Links `json:"links" copier:"Links"` | |||||
| Ports []Ports `json:"ports" copier:"Ports"` | |||||
| Portgroups []Portgroups `json:"portgroups" copier:"Portgroups"` | |||||
| States []States `json:"states" copier:"States"` | |||||
| ResourceClass string `json:"resource_class" copier:"ResourceClass"` | |||||
| BootInterface string `json:"boot_interface" copier:"BootInterface"` | |||||
| ConsoleInterface string `json:"console_interface" copier:"ConsoleInterface"` | |||||
| DeployInterface string `json:"deploy_interface" copier:"DeployInterface"` | |||||
| ConductorGroup string `json:"conductor_group" copier:"ConductorGroup"` | |||||
| InspectInterface string `json:"inspect_interface" copier:"InspectInterface"` | |||||
| ManagementInterface string `json:"management_interface" copier:"ManagementInterface"` | |||||
| NetworkInterface string `json:"network_interface" copier:"NetworkInterface"` | |||||
| PowerInterface string `json:"power_interface" copier:"PowerInterface"` | |||||
| RaidInterface string `json:"raid_interface" copier:"RaidInterface"` | |||||
| RescueInterface string `json:"rescue_interface" copier:"RescueInterface"` | |||||
| StorageInterface string `json:"storage_interface" copier:"StorageInterface"` | |||||
| Traits []string `json:"traits" copier:"Traits"` | |||||
| Volume []VolumeNode `json:"volume" copier:"Volume"` | |||||
| Protected bool `json:"protected" copier:"Protected"` | |||||
| ProtectedReason string `json:"protected_reason" copier:"ProtectedReason"` | |||||
| Conductor string `json:"conductor" copier:"Conductor"` | |||||
| Owner string `json:"owner" copier:"Owner"` | |||||
| Lessee string `json:"lessee" copier:"Lessee"` | |||||
| Shard string `json:"shard" copier:"Shard"` | |||||
| Description string `json:"description" copier:"Description"` | |||||
| AutomatedClean string `json:"automated_clean" copier:"AutomatedClean"` | |||||
| BiosInterface string `json:"bios_interface" copier:"BiosInterface"` | |||||
| NetworkData NetworkData `json:"network_data" copier:"NetworkData"` | |||||
| Retired bool `json:"retired" copier:"Retired"` | |||||
| RetiredReason string `json:"retired_reason" copier:"RetiredReason"` | |||||
| CreatedAt string `json:"created_at" copier:"CreatedAt"` | |||||
| InspectionFinishedAt string `json:"inspection_finished_at" copier:"InspectionFinishedAt"` | |||||
| InspectionStartedAt string `json:"inspection_started_at" copier:"InspectionStartedAt"` | |||||
| UpdatedAt string `json:"updated_at" copier:"UpdatedAt"` | |||||
| uuid string `json:"uuid" copier:"uuid"` | |||||
| ProvisionUpdatedAt string `json:"provision_updated_at" copier:"ProvisionUpdatedAt"` | |||||
| Code int32 `json:"code,omitempty"` | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| } | |||||
| Driver_info { | |||||
| ipmi_password string `json:"ipmi_password" copier:"ipmi_password"` | |||||
| ipmi_username string `json:"ipmi_username" copier:"ipmi_username"` | |||||
| } | |||||
| DriverInternalInfo { | |||||
| } | |||||
| InstanceInfo { | |||||
| } | |||||
| Extra{ | |||||
| } | |||||
| RaidConfig { | |||||
| } | |||||
| TargetRaidConfig{ | |||||
| } | |||||
| CleanStep{ | |||||
| } | |||||
| DeployStep{ | |||||
| } | |||||
| Ports{ | |||||
| href string `json:"href" copier:"href"` | |||||
| rel string `json:"rel" copier:"rel"` | |||||
| } | |||||
| Portgroups{ | |||||
| href string `json:"href" copier:"href"` | |||||
| rel string `json:"rel" copier:"rel"` | |||||
| } | |||||
| States { | |||||
| href string `json:"href" copier:"href"` | |||||
| rel string `json:"rel" copier:"rel"` | |||||
| } | |||||
| VolumeNode { | |||||
| href string `json:"href" copier:"href"` | |||||
| rel string `json:"rel" copier:"rel"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| DeleteNodeReq{ | |||||
| NodeIdent string `json:"node_ident" copier:"NodeIdent"` | |||||
| } | |||||
| DeleteNodeResp{ | |||||
| Code int32 `json:"code,omitempty"` | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| } | |||||
| ) | |||||
| type( | |||||
| ShowNodeDetailsReq{ | |||||
| NodeIdent string `json:"node_ident" copier:"NodeIdent"` | |||||
| Fields []Fields `json:"fields" copier:"Fields"` | |||||
| } | |||||
| Fields { | |||||
| } | |||||
| ShowNodeDetailsResp { | |||||
| AllocationUuid string `json:"allocation_uuid" copier:"AllocationUuid"` | |||||
| Name string `json:"name" copier:"name"` | |||||
| PowerState string `json:"power_state" copier:"PowerState"` | |||||
| TargetPowerState string `json:"target_power_state" copier:"TargetPowerState"` | |||||
| ProvisionState string `json:"provision_state" copier:"ProvisionState"` | |||||
| TargetProvisionState string `json:"target_provision_state" copier:"TargetProvisionState"` | |||||
| Maintenance bool `json:"maintenance" copier:"Maintenance"` | |||||
| MaintenanceReason string `json:"maintenance_reason" copier:"MaintenanceReason"` | |||||
| Fault string `json:"fault" copier:"Fault"` | |||||
| LastError string `json:"last_error" copier:"LastError"` | |||||
| Reservation string `json:"reservation" copier:"Reservation"` | |||||
| Driver string `json:"driver" copier:"Driver"` | |||||
| DriverInfo Driver_info `json:"driver_info" copier:"DriverInfo"` | |||||
| DriverInternalInfo DriverInternalInfo `json:"driver_internal_info" copier:"DriverInternalInfo"` | |||||
| Properties Properties `json:"properties" copier:"Properties"` | |||||
| InstanceInfo InstanceInfo `json:"instance_info" copier:"InstanceInfo"` | |||||
| InstanceUuid string `json:"instance_uuid" copier:"InstanceUuid"` | |||||
| ChassisUuid string `json:"chassis_uuid" copier:"ChassisUuid"` | |||||
| Extra Extra `json:"extra" copier:"Extra"` | |||||
| ConsoleEnabled bool `json:"console_enabled" copier:"ConsoleEnabled"` | |||||
| RaidConfig RaidConfig `json:"raid_config" copier:"RaidConfig"` | |||||
| TargetRaidConfig TargetRaidConfig `json:"target_raid_config" copier:"TargetRaidConfig"` | |||||
| CleanStep CleanStep `json:"clean_step" copier:"CleanStep"` | |||||
| DeployStep DeployStep `json:"clean_step" copier:"DeployStep"` | |||||
| Links []Links `json:"links" copier:"Links"` | |||||
| Ports []Ports `json:"ports" copier:"Ports"` | |||||
| Portgroups []Portgroups `json:"portgroups" copier:"Portgroups"` | |||||
| States []States `json:"states" copier:"States"` | |||||
| ResourceClass string `json:"resource_class" copier:"ResourceClass"` | |||||
| BootInterface string `json:"boot_interface" copier:"BootInterface"` | |||||
| ConsoleInterface string `json:"console_interface" copier:"ConsoleInterface"` | |||||
| DeployInterface string `json:"deploy_interface" copier:"DeployInterface"` | |||||
| ConductorGroup string `json:"conductor_group" copier:"ConductorGroup"` | |||||
| InspectInterface string `json:"inspect_interface" copier:"InspectInterface"` | |||||
| ManagementInterface string `json:"management_interface" copier:"ManagementInterface"` | |||||
| NetworkInterface string `json:"network_interface" copier:"NetworkInterface"` | |||||
| PowerInterface string `json:"power_interface" copier:"PowerInterface"` | |||||
| RaidInterface string `json:"raid_interface" copier:"RaidInterface"` | |||||
| RescueInterface string `json:"rescue_interface" copier:"RescueInterface"` | |||||
| StorageInterface string `json:"storage_interface" copier:"StorageInterface"` | |||||
| Traits []string `json:"traits" copier:"Traits"` | |||||
| Volume []VolumeNode `json:"volume" copier:"Volume"` | |||||
| Protected bool `json:"protected" copier:"Protected"` | |||||
| ProtectedReason string `json:"protected_reason" copier:"ProtectedReason"` | |||||
| Conductor string `json:"conductor" copier:"Conductor"` | |||||
| Owner string `json:"owner" copier:"Owner"` | |||||
| Lessee string `json:"lessee" copier:"Lessee"` | |||||
| Shard string `json:"shard" copier:"Shard"` | |||||
| Description string `json:"description" copier:"Description"` | |||||
| AutomatedClean string `json:"automated_clean" copier:"AutomatedClean"` | |||||
| BiosInterface string `json:"bios_interface" copier:"BiosInterface"` | |||||
| NetworkData NetworkData `json:"network_data" copier:"NetworkData"` | |||||
| Retired bool `json:"retired" copier:"Retired"` | |||||
| RetiredReason string `json:"retired_reason" copier:"RetiredReason"` | |||||
| CreatedAt string `json:"created_at" copier:"CreatedAt"` | |||||
| InspectionFinishedAt string `json:"inspection_finished_at" copier:"InspectionFinishedAt"` | |||||
| InspectionStartedAt string `json:"inspection_started_at" copier:"InspectionStartedAt"` | |||||
| UpdatedAt string `json:"updated_at" copier:"UpdatedAt"` | |||||
| uuid string `json:"uuid" copier:"uuid"` | |||||
| ProvisionUpdatedAt string `json:"provision_updated_at" copier:"ProvisionUpdatedAt"` | |||||
| Code int32 `json:"code,omitempty"` | |||||
| Msg string `json:"msg,omitempty"` | |||||
| ErrorMsg string `json:"errorMsg,omitempty"` | |||||
| } | |||||
| ) | |||||
| /******************Bare Metal end *************************/ | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func BulkCreateNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.BulkCreateNetworksReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewBulkCreateNetworksLogic(r.Context(), svcCtx) | |||||
| resp, err := l.BulkCreateNetworks(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func CreateNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.CreateNodeReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewCreateNodeLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateNode(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func CreateVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.CreateVolumeTypeReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewCreateVolumeTypesLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateVolumeTypes(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func DeleteNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.DeleteNodeReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewDeleteNodeLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteNode(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func DeleteVolumeTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.DeleteVolumeTypeReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewDeleteVolumeTypeLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteVolumeType(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func GetServersDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.GetServersDetailedByIdReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewGetServersDetailedByIdLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetServersDetailedById(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func ListNodesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.ListNodesReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewListNodesLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListNodes(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func ListVolumesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.ListVolumesReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewListVolumesLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListVolumes(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func PauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.PauseServerReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewPauseServerLogic(r.Context(), svcCtx) | |||||
| resp, err := l.PauseServer(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func RebootServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.RebootServerReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewRebootServerLogic(r.Context(), svcCtx) | |||||
| resp, err := l.RebootServer(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func ShowNetworkDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.ShowNetworkDetailsReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewShowNetworkDetailsLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ShowNetworkDetails(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func ShowNodeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.ShowNodeDetailsReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewShowNodeDetailsLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ShowNodeDetails(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func StartServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.StartServerReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewStartServerLogic(r.Context(), svcCtx) | |||||
| resp, err := l.StartServer(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func StopServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.StopServerReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewStopServerLogic(r.Context(), svcCtx) | |||||
| resp, err := l.StopServer(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func UpdateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.UpdateNetworkReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewUpdateNetworkLogic(r.Context(), svcCtx) | |||||
| resp, err := l.UpdateNetwork(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func UpdateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.UpdateServerReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewUpdateServerLogic(r.Context(), svcCtx) | |||||
| resp, err := l.UpdateServer(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package vm | |||||
| import ( | |||||
| "net/http" | |||||
| "github.com/zeromicro/go-zero/rest/httpx" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/logic/vm" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func UpdateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.UpdateVolumeReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := vm.NewUpdateVolumeLogic(r.Context(), svcCtx) | |||||
| resp, err := l.UpdateVolume(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type BulkCreateNetworksLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewBulkCreateNetworksLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BulkCreateNetworksLogic { | |||||
| return &BulkCreateNetworksLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *BulkCreateNetworksLogic) BulkCreateNetworks(req *types.BulkCreateNetworksReq) (resp *types.BulkCreateNetworksResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| BulkCreateNetworksReq := &openstack.BulkCreateNetworksReq{} | |||||
| err = copier.CopyWithOption(BulkCreateNetworksReq, req, copier.Option{Converters: tool.Converters}) | |||||
| BulkCreateNetworksResp, err := l.svcCtx.OpenstackRpc.BulkCreateNetworks(l.ctx, BulkCreateNetworksReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&BulkCreateNetworksResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &BulkCreateNetworksResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type CreateNodeLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewCreateNodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateNodeLogic { | |||||
| return &CreateNodeLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *CreateNodeLogic) CreateNode(req *types.CreateNodeReq) (resp *types.CreateNodeResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| CreateNodeReq := &openstack.CreateNodeReq{} | |||||
| err = copier.CopyWithOption(CreateNodeReq, req, copier.Option{Converters: tool.Converters}) | |||||
| CreateNodeResp, err := l.svcCtx.OpenstackRpc.CreateNode(l.ctx, CreateNodeReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&CreateNodeResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &CreateNodeResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type CreateVolumeTypesLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewCreateVolumeTypesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVolumeTypesLogic { | |||||
| return &CreateVolumeTypesLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *CreateVolumeTypesLogic) CreateVolumeTypes(req *types.CreateVolumeTypeReq) (resp *types.CreateVolumeTypeResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| CreateVolumeTypeReq := &openstack.CreateVolumeTypeReq{} | |||||
| err = copier.CopyWithOption(CreateVolumeTypeReq, req, copier.Option{Converters: tool.Converters}) | |||||
| CreateVolumeTypeResp, err := l.svcCtx.OpenstackRpc.CreateVolumeTypes(l.ctx, CreateVolumeTypeReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&CreateVolumeTypeResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &CreateVolumeTypeResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type DeleteNodeLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewDeleteNodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteNodeLogic { | |||||
| return &DeleteNodeLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *DeleteNodeLogic) DeleteNode(req *types.DeleteNodeReq) (resp *types.DeleteNodeResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| DeleteNodeReq := &openstack.DeleteNodeReq{} | |||||
| err = copier.CopyWithOption(DeleteNodeReq, req, copier.Option{Converters: tool.Converters}) | |||||
| DeleteNodeResp, err := l.svcCtx.OpenstackRpc.DeleteNode(l.ctx, DeleteNodeReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&DeleteNodeResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &DeleteNodeResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type DeleteVolumeTypeLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewDeleteVolumeTypeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteVolumeTypeLogic { | |||||
| return &DeleteVolumeTypeLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *DeleteVolumeTypeLogic) DeleteVolumeType(req *types.DeleteVolumeTypeReq) (resp *types.DeleteVolumeTypeResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| DeleteVolumeTypeReq := &openstack.DeleteVolumeTypeReq{} | |||||
| err = copier.CopyWithOption(DeleteVolumeTypeReq, req, copier.Option{Converters: tool.Converters}) | |||||
| DeleteVolumeTypeResp, err := l.svcCtx.OpenstackRpc.DeleteVolumeTypes(l.ctx, DeleteVolumeTypeReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&DeleteVolumeTypeResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &DeleteVolumeTypeResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type GetServersDetailedByIdLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewGetServersDetailedByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetServersDetailedByIdLogic { | |||||
| return &GetServersDetailedByIdLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *GetServersDetailedByIdLogic) GetServersDetailedById(req *types.GetServersDetailedByIdReq) (resp *types.GetServersDetailedByIdResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| GetServersDetailedByIdReq := &openstack.GetServersDetailedByIdReq{} | |||||
| err = copier.CopyWithOption(GetServersDetailedByIdReq, req, copier.Option{Converters: tool.Converters}) | |||||
| GetServersDetailedByIdResp, err := l.svcCtx.OpenstackRpc.GetServersDetailedById(l.ctx, GetServersDetailedByIdReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&GetServersDetailedByIdResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &GetServersDetailedByIdResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -33,7 +33,7 @@ func (l *ListImagesLogic) ListImages(req *types.ListImagesReq) (resp *types.List | |||||
| // todo: add your logic here and delete this line | // todo: add your logic here and delete this line | ||||
| ListImagesReq := &openstack.ListImagesReq{} | ListImagesReq := &openstack.ListImagesReq{} | ||||
| err = copier.CopyWithOption(ListImagesReq, req, copier.Option{Converters: utils.Converters}) | err = copier.CopyWithOption(ListImagesReq, req, copier.Option{Converters: utils.Converters}) | ||||
| ListImagesResp, err := l.svcCtx.OpenstackRpc.LisImages(l.ctx, ListImagesReq) | |||||
| ListImagesResp, err := l.svcCtx.OpenstackRpc.ListImages(l.ctx, ListImagesReq) | |||||
| if err != nil { | if err != nil { | ||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | ||||
| } | } | ||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type ListNodesLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewListNodesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListNodesLogic { | |||||
| return &ListNodesLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *ListNodesLogic) ListNodes(req *types.ListNodesReq) (resp *types.ListNodesResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| ListNodesReq := &openstack.ListNodesReq{} | |||||
| err = copier.CopyWithOption(ListNodesReq, req, copier.Option{Converters: tool.Converters}) | |||||
| ListNodesResp, err := l.svcCtx.OpenstackRpc.ListNodes(l.ctx, ListNodesReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&ListNodesResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &ListNodesResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type ListVolumesLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewListVolumesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListVolumesLogic { | |||||
| return &ListVolumesLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *ListVolumesLogic) ListVolumes(req *types.ListVolumesReq) (resp *types.ListVolumesResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| ListVolumesReq := &openstack.ListVolumesReq{} | |||||
| err = copier.CopyWithOption(ListVolumesReq, req, copier.Option{Converters: tool.Converters}) | |||||
| ListVolumesResp, err := l.svcCtx.OpenstackRpc.ListVolumes(l.ctx, ListVolumesReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Volumes list"), "Failed to get db Volumes list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&ListVolumesResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &ListVolumesResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type PauseServerLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewPauseServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PauseServerLogic { | |||||
| return &PauseServerLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *PauseServerLogic) PauseServer(req *types.PauseServerReq) (resp *types.PauseServerResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| PauseServerReq := &openstack.PauseServerReq{} | |||||
| err = copier.CopyWithOption(PauseServerReq, req, copier.Option{Converters: tool.Converters}) | |||||
| PauseServerResp, err := l.svcCtx.OpenstackRpc.PauseServer(l.ctx, PauseServerReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&PauseServerResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &PauseServerResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type RebootServerLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewRebootServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RebootServerLogic { | |||||
| return &RebootServerLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *RebootServerLogic) RebootServer(req *types.RebootServerReq) (resp *types.RebootServerResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| RebootServerReq := &openstack.RebootServerReq{} | |||||
| err = copier.CopyWithOption(RebootServerReq, req, copier.Option{Converters: tool.Converters}) | |||||
| RebootServerResp, err := l.svcCtx.OpenstackRpc.RebootServer(l.ctx, RebootServerReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&RebootServerResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &RebootServerResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type ShowNetworkDetailsLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewShowNetworkDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowNetworkDetailsLogic { | |||||
| return &ShowNetworkDetailsLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *ShowNetworkDetailsLogic) ShowNetworkDetails(req *types.ShowNetworkDetailsReq) (resp *types.ShowNetworkDetailsResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| ShowNetworkDetailsReq := &openstack.ShowNetworkDetailsReq{} | |||||
| err = copier.CopyWithOption(ShowNetworkDetailsReq, req, copier.Option{Converters: tool.Converters}) | |||||
| ShowNetworkDetailsResp, err := l.svcCtx.OpenstackRpc.ShowNetworkDetails(l.ctx, ShowNetworkDetailsReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Servers list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&ShowNetworkDetailsResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &ShowNetworkDetailsResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,30 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type ShowNodeDetailsLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewShowNodeDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowNodeDetailsLogic { | |||||
| return &ShowNodeDetailsLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *ShowNodeDetailsLogic) ShowNodeDetails(req *types.ShowNodeDetailsReq) (resp *types.ShowNodeDetailsResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| return | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type StartServerLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewStartServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StartServerLogic { | |||||
| return &StartServerLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *StartServerLogic) StartServer(req *types.StartServerReq) (resp *types.StartServerResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| StartServerReq := &openstack.StartServerReq{} | |||||
| err = copier.CopyWithOption(StartServerReq, req, copier.Option{Converters: tool.Converters}) | |||||
| StartServerResp, err := l.svcCtx.OpenstackRpc.StartServer(l.ctx, StartServerReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&StartServerResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &StartServerResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type StopServerLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewStopServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StopServerLogic { | |||||
| return &StopServerLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *StopServerLogic) StopServer(req *types.StopServerReq) (resp *types.StopServerResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| StopServerReq := &openstack.StopServerReq{} | |||||
| err = copier.CopyWithOption(StopServerReq, req, copier.Option{Converters: tool.Converters}) | |||||
| StopServerResp, err := l.svcCtx.OpenstackRpc.StopServer(l.ctx, StopServerReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&StopServerResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &StopServerResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type UpdateNetworkLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewUpdateNetworkLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateNetworkLogic { | |||||
| return &UpdateNetworkLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *UpdateNetworkLogic) UpdateNetwork(req *types.UpdateNetworkReq) (resp *types.UpdateNetworkResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| UpdateNetworkReq := &openstack.UpdateNetworkReq{} | |||||
| err = copier.CopyWithOption(UpdateNetworkReq, req, copier.Option{Converters: tool.Converters}) | |||||
| UpdateNetworkResp, err := l.svcCtx.OpenstackRpc.UpdateNetwork(l.ctx, UpdateNetworkReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&UpdateNetworkResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &UpdateNetworkResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type UpdateServerLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewUpdateServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateServerLogic { | |||||
| return &UpdateServerLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *UpdateServerLogic) UpdateServer(req *types.UpdateServerReq) (resp *types.UpdateServerResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| UpdateServerReq := &openstack.UpdateServerReq{} | |||||
| err = copier.CopyWithOption(UpdateServerReq, req, copier.Option{Converters: tool.Converters}) | |||||
| UpdateServerResp, err := l.svcCtx.OpenstackRpc.UpdateServer(l.ctx, UpdateServerReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&UpdateServerResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &UpdateServerResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package vm | |||||
| import ( | |||||
| "context" | |||||
| "github.com/jinzhu/copier" | |||||
| "github.com/pkg/errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-participant-openstack/openstack" | |||||
| "gitlink.org.cn/jcce-pcm/utils/result" | |||||
| "gitlink.org.cn/jcce-pcm/utils/tool" | |||||
| "gitlink.org.cn/jcce-pcm/utils/xerr" | |||||
| "k8s.io/apimachinery/pkg/util/json" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type UpdateVolumeLogic struct { | |||||
| logx.Logger | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| } | |||||
| func NewUpdateVolumeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateVolumeLogic { | |||||
| return &UpdateVolumeLogic{ | |||||
| Logger: logx.WithContext(ctx), | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| } | |||||
| } | |||||
| func (l *UpdateVolumeLogic) UpdateVolume(req *types.UpdateVolumeReq) (resp *types.UpdateVolumeResp, err error) { | |||||
| // todo: add your logic here and delete this line | |||||
| UpdateVolumeReq := &openstack.UpdateVolumeReq{} | |||||
| err = copier.CopyWithOption(UpdateVolumeReq, req, copier.Option{Converters: tool.Converters}) | |||||
| UpdateServerResp, err := l.svcCtx.OpenstackRpc.UpdateVolume(l.ctx, UpdateVolumeReq) | |||||
| if err != nil { | |||||
| return nil, errors.Wrapf(xerr.NewErrMsg("c端创建失败"), "c端创建失败 : %v ,req:%+v", err, req) | |||||
| } | |||||
| marshal, err := json.Marshal(&UpdateServerResp) | |||||
| if err != nil { | |||||
| return nil, result.NewDefaultError(err.Error()) | |||||
| } | |||||
| json.Unmarshal(marshal, &resp) | |||||
| err = copier.CopyWithOption(&resp, &UpdateServerResp, copier.Option{Converters: tool.Converters}) | |||||
| return resp, err | |||||
| } | |||||
| @@ -25,7 +25,7 @@ require ( | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20230830120334-bf6d99c715ef | gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20230830120334-bf6d99c715ef | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20230719015658-08a29549d86a | gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20230719015658-08a29549d86a | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4 | gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4 | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20230904093908-860f0b2b4eb4 | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20231012071552-57fd38592ad2 | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 | gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 | ||||
| gitlink.org.cn/jcce-pcm/utils v0.0.2 | gitlink.org.cn/jcce-pcm/utils v0.0.2 | ||||
| go.opentelemetry.io/otel/trace v1.14.0 | go.opentelemetry.io/otel/trace v1.14.0 | ||||
| @@ -1039,8 +1039,8 @@ gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20230719015658-08a29549 | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20230719015658-08a29549d86a/go.mod h1:BhOgwM1LC+BD46DjTaQyYQVZs1CikwI5Pl/6qzKUexc= | gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20230719015658-08a29549d86a/go.mod h1:BhOgwM1LC+BD46DjTaQyYQVZs1CikwI5Pl/6qzKUexc= | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4 h1:iv78VZ5+j6/VNkEyD/GSmTJ96rpxzpKDUNknAoXsAmg= | gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4 h1:iv78VZ5+j6/VNkEyD/GSmTJ96rpxzpKDUNknAoXsAmg= | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4/go.mod h1:uyvpVqG1jHDXX+ubXI0RBwnWXzVykD/mliqGQIDvRoo= | gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4/go.mod h1:uyvpVqG1jHDXX+ubXI0RBwnWXzVykD/mliqGQIDvRoo= | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20230904093908-860f0b2b4eb4 h1:uflRHFdG0fXwqwfHc8LVgs3DG0n4cIKBW+X7F9XgNXE= | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20230904093908-860f0b2b4eb4/go.mod h1:JRFx7CjtUDyjJGyLWuInhr4rKfqcNY66Fxi+jq+Y+sc= | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20231012071552-57fd38592ad2 h1:0r3AU7o7+kASjV9yqFMZznqDboUTMavY8FdqoFEbfqk= | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20231012071552-57fd38592ad2/go.mod h1:zFMf8Rx4jHD9MmFHqVADPa6m9aTQPrAA4om6jjYvJOk= | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 h1:r2hBP5G/bbkPpDTPk3ENnQxD82vkoYMSeNHYhNAVRX4= | gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 h1:r2hBP5G/bbkPpDTPk3ENnQxD82vkoYMSeNHYhNAVRX4= | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4/go.mod h1:zRdVJiv4r4jgBli2xpYGmV0n6Gmz8fkZ5pJaNK2MbTU= | gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4/go.mod h1:zRdVJiv4r4jgBli2xpYGmV0n6Gmz8fkZ5pJaNK2MbTU= | ||||
| gitlink.org.cn/jcce-pcm/utils v0.0.2 h1:Stif8W9C9TOCS2hw4g+OlOywDrsVYNrkiyKfBrWkT0w= | gitlink.org.cn/jcce-pcm/utils v0.0.2 h1:Stif8W9C9TOCS2hw4g+OlOywDrsVYNrkiyKfBrWkT0w= | ||||