fix: Remove useless api codes

1. Remove useless api codes
2. Remove useless endpoints in client
3. Update arrow func in overview admin to normal func for better inheritance
4. Remove useless libs codes
5. Remove useless variables in overview codes

Change-Id: Iffecb73fe0a4a23c57303f67965d9528688da87a
This commit is contained in:
Jingwei.Zhang
2021-09-08 10:21:44 +08:00
parent dbcf276094
commit 360f387aa8
71 changed files with 26 additions and 4601 deletions

View File

@@ -1,47 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Create a restore on backup
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} backupId The UUID of the backupchains.
* @param {Object} data request body
* @param {Object} data.restore The restore object.
* @returns {Promise}
*/
export const createBackupRestoreOnCinder = (projectId, backupId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/backups/${backupId}/restore`),
data,
});
/**
* Create a restore on backup chain
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} backupId The UUID of the backupchains.
* @param {Object} data request body
* @param {Object} data.restore The restore object.
* @returns {Promise}
*/
export const createBackupChainRestoreOnCinder = (projectId, backupId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/backup_chains/${backupId}/restore`),
data,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { cinderBase } from 'client/client/constants';
const getCinderBaseUrl = (key) => `${cinderBase()}/${key}`;
export default getCinderBaseUrl;

View File

@@ -1,31 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Show quota usage for a project
* @param {String} adminProjectId The UUID of the administrative project.
* @param {Object} params request query
* @param {Boolean} params.usage Default : false
* @returns {Promise}
*/
export const fetchAvailabilityZoneOnProject = (adminProjectId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${adminProjectId}/os-availability-zone`),
params,
});

View File

@@ -1,52 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Show quota usage for a project
* @param {String} adminProjectId The UUID of the administrative project.
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} params request query
* @param {Boolean} params.usage Default : false
* @returns {Promise}
*/
export const fetchQuotaUsageOnProject = (adminProjectId, projectId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${adminProjectId}/os-quota-sets/${projectId}`),
params,
});
/**
* Update quotas for a project
* @param {String} adminProjectId The UUID of the tenant in a multi-tenancy cloud.
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} data request body
* @param {Object} data.quota_set A quota object.
* @param {String} data.quota_set.volumes The number of volumes that are allowed for each project.
* @param {Number} data.quota_set.gigabytes The size (GB) of volumes and snapshots that are allowed for each project.
* @param {Number} data.quota_set.backup_gigabytes The size (GB) of backups that are allowed for each project.
* @param {Number} data.quota_set.snapshots The number of snapshots that are allowed for each project.
* @param {Number} data.quota_set.backups The number of backups that are allowed for each project.
* @returns {Promise}
*/
export const updateCinderQuotaSets = (adminProjectId, projectId, data) =>
axios.request({
method: 'put',
url: cinderBase(`${adminProjectId}/os-quota-sets/${projectId}`),
data,
});

View File

@@ -1,54 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Cinder Service change
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} actionName Actions name Avaliable Values : disable,disable-log-reason,enable,get-log,set-log,freeze,thaw,failover_host
* @param {Object} data request body
* @param {String} data.host The name of the host, when actionName is disable
* @param {String} data.binary The binary name of the service, when actionName is disable
* @param {String} data.disabled_reason The reason for disabling a service.
* @param {String} data.server The name of the host.
* @param {String} data.prefix The prefix for the log path we are querying, for example cinder. or sqlalchemy.engine
* @param {String} data.levels The log level to set, case insensitive, accepted values are INFO, WARNING, ERROR and DEBUG.
* @param {String} data.backend_id ID of backend to failover to. Default is None.
* @param {String} data.cluster The cluster name. Only in cinder-volume service.New in version 3.7
* @returns {Promise}
*/
export const toggleChangeCinderOsService = (projectId, actionName, data) =>
axios.request({
method: 'put',
url: cinderBase(`${projectId}/os-services/${actionName}`),
data,
});
/**
* List All Cinder Services
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} params request query
* @param {String} params.binary Filter the service list result by binary name of the service.
* @param {String} params.host Filter the service list result by host name of the service.
* @returns {Promise}
*/
export const fetchListCinderServices = (projectId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/os-services`),
params,
});

View File

@@ -1,106 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Create a QoS specification
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} data request body
* @param {Object} data.qos_specs A qos_specs object.
* @param {String} data.qos_specs.name The name of the QoS specification.
* @returns {Promise}
*/
export const createQosSpecOnCinder = (projectId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/qos-specs`),
data,
});
/**
* Set keys in a QoS specification
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} qosId The ID of the QoS specification.
* @param {Object} data request body
* @param {Object} data.qos_specs A qos_specs object.
* @returns {Promise}
*/
export const updateQosSpecOnCinder = (projectId, qosId, data) =>
axios.request({
method: 'put',
url: cinderBase(`${projectId}/qos-specs/${qosId}`),
data,
});
/**
* Unset keys in a QoS specification
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} qosId The ID of the QoS specification.
* @param {Object} data request body
* @param {Array} data.keys List of Keys.
* @returns {Promise}
*/
export const deleteKeysInQosSpecOnCinder = (projectId, qosId, data) =>
axios.request({
method: 'put',
url: cinderBase(`${projectId}/qos-specs/${qosId}`),
data,
});
/**
* Associate QoS specification with a volume type
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} qosId The ID of the QoS specification.
* @param {Object} params request query
* @param {Object} params.vol_type_id A volume type ID.
* @returns {Promise}
*/
export const fetchAssociateQosSpecOnCinder = (projectId, qosId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/qos-specs/${qosId}/associate`),
params,
});
/**
* Disassociate QoS specification from a volume type
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} qosId The ID of the QoS specification.
* @param {Object} params request query
* @param {Object} params.vol_type_id A volume type ID.
* @returns {Promise}
*/
export const fetchDisassociateQosSpecOnCinder = (projectId, qosId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/qos-specs/${qosId}/associate`),
params,
});
/**
* Show a QoS specification details
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} qosId The ID of the QoS specification.
* @param {Object} params request query
* @returns {Promise}
*/
export const fetchQosSpecDetailsOnCinder = (projectId, qosId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/qos-specs/${qosId}`),
params,
});

View File

@@ -1,62 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* List accessible snapshots
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} params request body
* @param {String} params.all_tenants Shows details for all project. Admin only.
* @param {String} params.sort A valid direction is asc (ascending) or desc (descending).
* @param {String} params.limit Default value : 10
* @param {String} params.offset Used in conjunction with limit to return a slice of items.
* @param {String} params.marker The ID of the last-seen item.
* @param {String} params.with_count Whether to show count in API response or not, default is False.
* @returns {Promise}
*/
export const fetchListAccessibleSnapshots = (projectId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/snapshots`),
params,
});
/**
* Show a snapshots details
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} snapshotId The UUID of the snapshot.
* @returns {Promise}
*/
export const fetchListAccessibleSnapshotDetails = (projectId, snapshotId) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/snapshots/${snapshotId}`),
});
/**
* Update a snapshot
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} snapshotId The UUID of the snapshot.
* @param {Object} data request body
* @returns {Promise}
*/
export const updateSnapshotOnCinder = (projectId, snapshotId, data) =>
axios.request({
method: 'put',
url: cinderBase(`${projectId}/snapshots/${snapshotId}`),
data,
});

View File

@@ -1,180 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Show all extra specifications for volume type
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The UUID for an existing volume type.
* @param {Object} params request query
* @returns {Promise}
*/
export const fetchExtraSpecsForTypes = (projectId, volumeTypeId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/types/${volumeTypeId}/extra_specs`),
params,
});
/**
* Create or update extra specs for volume type
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The UUID for an existing volume type.
* @param {Object} body request body
* @param {Object} body.extra_specs A set of key and value pairs that contains the specifications for a volume type.
* @returns {Promise}
*/
export const createExtraSpecsForTypes = (projectId, volumeTypeId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/types/${volumeTypeId}/extra_specs`),
data,
});
/**
* Delete extra specification for volume type
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The UUID for an existing volume type.
* @param {String} keyName The key name of the extra spec for a volume type.
* @returns {Promise}
*/
export const deleteExtraSpecsForTypes = (projectId, volumeTypeId, keyName) =>
axios.request({
method: 'delete',
url: cinderBase(
`${projectId}/types/${volumeTypeId}/extra_specs/${keyName}`
),
});
/**
* Create volume type for v2
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} data request body
* @param {Object} data.volume_type A volume_type object.
* @param {String} data.volume_type.name The name of the Volume Transfer.
* @param {String} data.volume_type.description The backup description or null.
* @param {Boolean} data.volume_type.is_public Volume type which is accessible to the public.
* @param {Object} data.volume_type.extra_specs A set of key and value pairs that contains the specifications for a volume type.
* @param {String} data.volume_type.extra_specs.capabilities example : "gpu"
* @returns {Promise}
*/
export const createVolumeType = (projectId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/types`),
data,
});
/**
* Update volume type
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The UUID for an existing volume type.
* @param {Object} data request body
* @param {Object} data.volume_type A volume_type object.
* @param {String} data.volume_type.name The name of the Volume Transfer.
* @param {String} data.volume_type.description The backup description or null.
* @param {Boolean} data.volume_type.is_public Volume type which is accessible to the public.
* @param {Object} data.volume_type.extra_specs A set of key and value pairs that contains the specifications for a volume type.
* @param {String} data.volume_type.extra_specs.capabilities example : "gpu"
* @returns {Promise}
*/
export const updateVolumeType = (projectId, volumeTypeId, data) =>
axios.request({
method: 'put',
url: cinderBase(`${projectId}/types/${volumeTypeId}`),
data,
});
/**
* Show an encryption type for v2
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The UUID for an existing volume type.
* @returns {Promise}
*/
export const fetchVolumeTypesEncryption = (projectId, volumeTypeId) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/types/${volumeTypeId}/encryption`),
});
/**
* Create an encryption type for v2
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The UUID for an existing volume type.
* @param {Object} data request body
* @param {Object} data.encryption The encryption information.
* @param {String} data.encryption.key_size Size of encryption key, in bits. For example, 128 or 256. The default value is None.
* @param {String} data.encryption.provider The class that provides encryption support.
* @param {Boolean} data.encryption.control_location The default value is “front-end”.
* @param {Object} data.encryption.cipher The encryption algorithm or mode. For example, aes-xts-plain64. The default value is None.
* @returns {Promise}
*/
export const createVolumeTypesEncryption = (projectId, volumeTypeId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/types/${volumeTypeId}/encryption`),
data,
});
/**
* Delete an encryption type for v2
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The UUID for an existing volume type.
* @param {String} encryptionId The ID of the encryption type.
* @returns {Promise}
*/
export const deleteVolumeTypesEncryption = (
projectId,
volumeTypeId,
encryptionId
) =>
axios.request({
method: 'delete',
url: cinderBase(
`${projectId}/types/${volumeTypeId}/encryption/${encryptionId}`
),
});
/**
* Add private volume type access
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The ID of Volume Type to be accessed by project.
* @param {Object} data request body
* @param {Object} data.addProjectAccess A addProjectAccess object. When add request
* @param {String} data.addProjectAccess.project The ID of the project. When add request
* @param {Object} data.removeProjectAccess A removeProjectAccess project. When delete request
* @param {String} data.removeProjectAccess.project The ID of the project. When delete request
* @returns {Promise}
*/
export const addOrDeleteVolumeTypeAccess = (projectId, volumeTypeId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/types/${volumeTypeId}/action`),
data,
});
/**
* List private volume type access details
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeTypeId The ID of Volume Type to be accessed by project.
* @returns {Promise}
*/
export const fetchVolumeTypesAccessDetails = (projectId, volumeTypeId) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/types/${volumeTypeId}/os-volume-type-access`),
});

View File

@@ -1,80 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Create a volume transfer
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} data request body
* @param {Object} data.transfer The volume transfer object.
* @param {String} data.transfer.name The name of the object.
* @param {String} data.transfer.volume_id The UUID of the volume.
* @param {Boolean} data.transfer.no_snapshots Transfer volume without snapshots. Defaults to False if not specified.
* @returns {Promise}
*/
export const createVolumenTransfer = (projectId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/volume-transfers`),
data,
});
/**
* List volume transfers for a project
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} params request query
* @param {Object} params.all_tenants Shows details for all project. Admin only.
* @param {String} params.limit Requests a page size of items. Returns a number of items up to a limit value.
* @param {String} params.offset Used in conjunction with limit to return a slice of items. offset is where to start in the list.
* @param {Boolean} params.marker The ID of the last-seen item.
* @param {Boolean} params.sort_key Sorts by an attribute. Default is created_at.
* @param {Boolean} params.sort_dir Sorts by one or more sets of attribute and sort direction combinations.
* @returns {Promise}
*/
export const fetchVolumenTransfersForProject = (projectId, params) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/volume-transfers`),
params,
});
/**
* Delete a volume transfer
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} transferId The unique identifier for a volume transfer.
* @returns {Promise}
*/
export const deleteVolumenTransfer = (projectId, transferId) =>
axios.request({
method: 'delete',
url: cinderBase(`${projectId}/volume-transfers/${transferId}`),
});
/**
* Accept a volume transfer
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} data request body
* @param {Object} data.accept The accept object.
* @param {String} data.accept.auth_key The name of the object.
* @returns {Promise}
*/
export const acceptVolumenTransfer = (projectId, transferId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/volume-transfers/${transferId}/accept`),
data,
});

View File

@@ -1,62 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Show a volumes details
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} volumeId The UUID of the volume.
* @returns {Promise}
*/
export const fetchAccessibleVolumeDetails = (projectId, volumeId) =>
axios.request({
method: 'get',
url: cinderBase(`${projectId}/volumes/${volumeId}`),
});
/**
* Volume actions
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {Object} volumeId The UUID of the volume.
* @param {Object} data request body
* @see https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=id356-detail#volume-transfers-volume-transfers-3-55-or-later
* @returns {Promise}
*/
export const volumeActionsOnCinder = (projectId, volumeId, data) =>
axios.request({
method: 'post',
url: cinderBase(`${projectId}/volumes/${volumeId}/action`),
data,
});
/**
* Update a volume
* @param {String} projectId The UUID of the project in a multi-tenancy cloud.
* @param {String} volumeId The UUID of the volume.
* @param {Object} data request body
* @param {Object} data.volume A volume object.
* @param {String} data.volume.description The volume description.
* @param {String} data.volume.name The volume name.
* @param {Object} data.volume.metadata One or more metadata key and value pairs that are associated with the volume.
* @returns {Promise}
*/
export const updateVolumeOnCinder = (projectId, volumeId, data) =>
axios.request({
method: 'put',
url: cinderBase(`${projectId}/volumes/${volumeId}/action`),
data,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { glanceBase } from 'client/client/constants';
const getGlanceBaseUrl = (key) => `${glanceBase()}/${key}`;
export default getGlanceBaseUrl;

View File

@@ -1,174 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Create image
* @param {Object} data request body
* @param {String} data.container_format Format of the image container.
* @param {String} data.disk_format The format of the disk.
* @param {String} data.id A unique, user-defined image UUID, in the format: nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn
* @param {Number} data.min_disk Amount of disk space in GB that is required to boot the image.
* @param {Number} data.min_ram Amount of RAM in MB that is required to boot the image.
* @param {String} data.name The name of the image.
* @param {Boolean} data.protected Image protection for deletion.
* @param {Array} data.tags List of tags for this image.
* @param {String} data.visibility Visibility for this image. Valid value is one of: public, private, shared, or community.
* @returns {Promise}
*/
export const createImage = (data) =>
axios.request({
method: 'post',
url: cinderBase('images'),
data,
});
/**
* Update image
* @param {String} imageId The UUID of the image.
* @param {Object} data request body
* @param {String} data.container_format Format of the image container.
* @param {String} data.disk_format The format of the disk.
* @param {String} data.id A unique, user-defined image UUID, in the format: nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn
* @param {Number} data.min_disk Amount of disk space in GB that is required to boot the image.
* @param {Number} data.min_ram Amount of RAM in MB that is required to boot the image.
* @param {String} data.name The name of the image.
* @param {Boolean} data.protected Image protection for deletion.
* @param {Array} data.tags List of tags for this image.
* @param {String} data.visibility Visibility for this image. Valid value is one of: public, private, shared, or community.
* @returns {Promise}
*/
export const updateImage = (imageId, data) =>
axios.request({
method: 'patch',
url: cinderBase(`images/${imageId}`),
headers: {
'content-type': 'application/openstack-images-v2.1-json-patch',
},
data,
});
/**
* Upload binary image data
* Set the Content-Type request header to application/octet-stream.
* @param {String} imageId The UUID of the image.
* @param {File} data Image file
* @returns {Promise}
*/
export const uploadBinaryImageData = (imageId, data) =>
axios.request({
method: 'put',
url: cinderBase(`images/${imageId}/file`),
headers: {
'content-type': 'application/octet-stream',
},
data,
});
/**
* List images
* @param {Object} params request query
* @param {Number} params.limit Requests a page size of items
* @param {String} params.disk_format Example : "iso"
* @param {String} params.marker The ID of the last-seen item.
* @param {String} params.name Filters the response by a name.
* @param {String} params.owner Filters the response by a project (also called a “tenant”) ID.
* @param {Boolean} params.protected Filters the response by the protected image property.
* @param {Number} params.status Filters the response by an image status.
* @param {Number} params.tag Filters the response by the specified tag value.
* @param {String} params.visibility Filters the response by an image visibility value.
* @param {Boolean} params.os_hidden When true, filters the response to display only “hidden” images.
* @param {String} params.member_status Filters the response by a member status.
* @param {String} params.size_max Filters the response by a maximum image size, in bytes.
* @param {String} params.size_min Filters the response by a minimum image size, in bytes.
* @param {String} params.created_at Specify a comparison filter based on the date and time when the resource was created.
* @param {String} params.updated_at Specify a comparison filter based on the date and time when the resource was most recently modified.
* @param {String} params.sort_dir Sorts the response by a set of one or more sort direction and attribute (sort_key) combinations.
* @param {String} params.sort_key Sorts the response by an attribute, such as name, id, or updated_at.
* @param {String} params.sort Sorts the response by one or more attribute and sort direction combinations. You can also set multiple sort keys and directions. Default direction is desc.
* @returns {Promise}
*/
export const fetchImages = (params) =>
axios.request({
method: 'get',
url: cinderBase('images'),
params,
});
/**
* List image members
* @param {String} imageId The UUID of the image.
* @returns {Promise}
*/
export const fetchListImageMembers = (imageId) =>
axios.request({
method: 'get',
url: cinderBase(`images/${imageId}/members`),
});
/**
* Create image member
* @param {String} imageId The UUID of the image.
* @param {Object} data request body
* @param {String} data.member The ID of the image member.
* @returns {Promise}
*/
export const createImageMember = (imageId, data) =>
axios.request({
method: 'get',
url: cinderBase(`images/${imageId}/members`),
data,
});
/**
* Update image member
* @param {String} imageId The UUID of the image.
* @param {String} memberId The ID of the image member.
* @param {Object} data request body
* @param {String} data.status The status of this image member. Value is one of pending, accepted, rejected.
* @returns {Promise}
*/
export const updateImageMember = (imageId, memberId, data) =>
axios.request({
method: 'put',
url: cinderBase(`images/${imageId}/members/${memberId}`),
data,
});
/**
* Delete image member
* @param {String} imageId The UUID of the image.
* @param {String} memberId The ID of the image member.
* @returns {Promise}
*/
export const deleteImageMember = (imageId, memberId) =>
axios.request({
method: 'delete',
url: cinderBase(`images/${imageId}/members/${memberId}`),
});
/**
* List images count
* @param {Object} params request query
* @returns {Promise}
*/
export const fetchImagesCountOnGlance = (params) =>
axios.request({
method: 'get',
url: cinderBase('images/count'),
params,
});

View File

@@ -1,106 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import cinderBase from './base';
/**
* Get namespace details
* @param {String} namespaceName The name of the namespace whose details you want to see.
* @param {Object} params request query
* @param {String} params.resource_type Apply the prefix for the specified resource type to the names of the properties listed in the response.
* @returns {Promise}
*/
export const fetchNamespaceDetailsOnGlance = (namespaceName, params) =>
axios.request({
method: 'get',
url: cinderBase(`metadefs/namespaces/${namespaceName}`),
params,
});
/**
* Update namespace
* @param {String} namespaceName The name of the namespace whose details you want to see.
* @param {Object} data request body
* @param {String} data.description The description of the namespace.
* @param {String} data.display_name User-friendly name to use in a UI to display the namespace name.
* @param {String} data.namespace An identifier (a name) for the namespace.
* @param {Boolean} data.protected Namespace protection for deletion. A valid value is true or false. Default is false.
* @param {String} data.visibility The namespace visibility. A valid value is public or private. Default is private.
* @returns {Promise}
*/
export const updateNamespaceOnGlance = (namespaceName, data) =>
axios.request({
method: 'put',
url: cinderBase(`metadefs/namespaces/${namespaceName}`),
data,
});
/**
* Create namespace
* @param {Object} data request body
* @param {String} data.description The description of the namespace.
* @param {String} data.display_name User-friendly name to use in a UI to display the namespace name.
* @param {String} data.namespace An identifier (a name) for the namespace.
* @param {Boolean} data.protected Namespace protection for deletion. A valid value is true or false. Default is false.
* @param {String} data.visibility The namespace visibility. A valid value is public or private. Default is private.
* @returns {Promise}
*/
export const createNamespaceOnGlance = (data) =>
axios.request({
method: 'post',
url: cinderBase('metadefs/namespaces'),
data,
});
/**
* List resource types
* @returns {Promise}
*/
export const fetchListResourceTypesOnGlance = () =>
axios.request({
method: 'get',
url: cinderBase('metadefs/resource_types'),
});
/**
* Remove resource type association
* @param {String} namespaceName The name of the namespace whose details you want to see.
* @param {String} resourceTypeName The name of the resource type.
* @returns {Promise}
*/
export const deleteResourceTypeOnGlance = (namespaceName, resourceTypeName) =>
axios.request({
method: 'delete',
url: cinderBase(
`metadefs/namespaces/${namespaceName}/resource_types/${resourceTypeName}`
),
});
/**
* Create resource type association
* @param {String} namespaceName The name of the namespace whose details you want to see.
* @param {Object} data request body
* @param {String} data.name Name of the resource type. A Name is limited to 80 chars in length.
* @param {String} data.prefix Prefix for any properties in the namespace that you want to apply to the resource type.
* @param {String} data.properties_target Some resource types allow more than one key and value pair for each instance.
* @returns {Promise}
*/
export const createResourceTypeOnGlance = (namespaceName, data) =>
axios.request({
method: 'post',
url: cinderBase(`metadefs/namespaces/${namespaceName}/resource_types`),
data,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { gocronBase } from 'client/client/constants';
const getGocronBaseUrl = (key) => `${gocronBase()}/${key}`;
export default getGocronBaseUrl;

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { heatBase } from 'client/client/constants';
const getHeatBaseUrl = (key) => `${heatBase()}/${key}`;
export default getHeatBaseUrl;

View File

@@ -1,86 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getHeatBaseUrl from './base';
/**
* Create stack
* @param {Object} tenantId The UUID of the tenant. A tenant is also known as a project.
* @param {Object} data request body
* @see https://docs.openstack.org/api-ref/orchestration/v1/index.html?expanded=create-stack-detail#stacks
* @returns {Promise}
*/
export const createStackOnHeat = (tenantId, data) =>
axios.request({
method: 'post',
url: getHeatBaseUrl(`${tenantId}/stacks`),
data,
});
/**
* Update stack
* @param {Object} tenantId The UUID of the tenant. A tenant is also known as a project.
* @param {Object} stackName The name of a stack.
* @param {Object} stackId The UUID of the stack.
* @param {Object} data request body
* @see https://docs.openstack.org/api-ref/orchestration/v1/index.html?expanded=update-stack-detail#stacks
* @returns {Promise}
*/
export const updateStackOnHeat = (tenantId, stackName, stackId, data) =>
axios.request({
method: 'post',
url: getHeatBaseUrl(`${tenantId}/stacks/${stackName}/${stackId}`),
data,
});
/**
* Delete stack
* @param {Object} tenantId The UUID of the tenant. A tenant is also known as a project.
* @param {Object} stackName The name of a stack.
* @param {Object} stackId The UUID of the stack.
* @returns {Promise}
*/
export const deleteStackOnHeat = (tenantId, stackName, stackId) =>
axios.request({
method: 'delete',
url: getHeatBaseUrl(`${tenantId}/stacks/${stackName}/${stackId}`),
});
/**
* Abandon stack
* @param {Object} tenantId The UUID of the tenant. A tenant is also known as a project.
* @param {Object} stackName The name of a stack.
* @param {Object} stackId The UUID of the stack.
* @returns {Promise}
*/
export const abandonStackOnHeat = (tenantId, stackName, stackId) =>
axios.request({
method: 'delete',
url: getHeatBaseUrl(`${tenantId}/stacks/${stackName}/${stackId}/abandon`),
});
/**
* Get stack template
* @param {Object} tenantId The UUID of the tenant. A tenant is also known as a project.
* @param {Object} stackName The name of a stack.
* @param {Object} stackId The UUID of the stack.
* @returns {Promise}
*/
export const fetchStackTemplateOnHeat = (tenantId, stackName, stackId) =>
axios.request({
method: 'get',
url: getHeatBaseUrl(`${tenantId}/stacks/${stackName}/${stackId}/template`),
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { ironicInspectorBase } from 'client/client/constants';
const getIronicInspectorBaseUrl = (key) => `${ironicInspectorBase()}/${key}`;
export default getIronicInspectorBaseUrl;

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { ironicBase } from 'client/client/constants';
const getIronicBaseUrl = (key) => `${ironicBase()}/${key}`;
export default getIronicBaseUrl;

View File

@@ -1,205 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getIronicBaseUrl from './base';
/**
* Create Node
* @param {Object} data request body
* @param {String} data.console_interface The boot interface for a Node, e.g. “pxe”.
* @param {String} data.conductor_group The conductor group for a node.
* @param {String} data.console_interface The console interface for a node, e.g. “no-console”.
* @param {String} data.deploy_interface The deploy interface for a node, e.g. “iscsi”.
* @param {String} data.driver_info All the metadata required by the driver to manage this Node.
* @param {String} data.driver The name of the driver used to manage this Node.
* @param {String} data.extra A set of one or more arbitrary metadata key and value pairs.
* @param {String} data.inspect_interface The interface used for node inspection, e.g. “no-inspect”.
* @param {String} data.management_interface Interface for out-of-band node management, e.g. “ipmitool”.
* @param {String} data.name Human-readable identifier for the Node resource. May be undefined. Certain words are reserved.
* @param {String} data.network_interface Which Network Interface provider to use when plumbing the network connections for this Node.
* @param {String} data.power_interface Interface used for performing power actions on the node, e.g. “ipmitool”.
* @param {String} data.properties Physical characteristics of this Node.
* @param {String} data.raid_interface Interface used for configuring RAID on this node, e.g. “no-raid”.
* @param {String} data.rescue_interface The interface used for node rescue, e.g. “no-rescue”.
* @param {String} data.resource_class A string which can be used by external schedulers to identify this Node as a unit of a specific type of resource.
* @param {String} data.storage_interface Interface used for attaching and detaching volumes on this node, e.g. “cinder”.
* @see https://docs.openstack.org/api-ref/baremetal/?expanded=create-node-detail
* @returns {Promise}
*/
export const createNodeOnIronic = (data) =>
axios.request({
method: 'post',
url: getIronicBaseUrl('nodes'),
data,
});
/**
* Update Node
* @param {String} nodeIdent The UUID or Name of the node.
* @see https://docs.openstack.org/api-ref/baremetal/?expanded=update-node-detail
* @returns {Promise}
*/
export const updateNodeOnIronic = (nodeIdent, data) =>
axios.request({
method: 'patch',
url: getIronicBaseUrl(`nodes/${nodeIdent}`),
data,
});
/**
* Node State Summary
* @param {String} nodeIdent The UUID or Name of the node.
* @returns {Promise}
*/
export const fetchNodeStateSummaryOnIronic = (nodeIdent) =>
axios.request({
method: 'get',
url: getIronicBaseUrl(`nodes/${nodeIdent}/states`),
});
/**
* Validate Node
* @param {String} nodeIdent The UUID or Name of the node.
* @returns {Promise}
*/
export const fetchNodeValidateOnIronic = (nodeIdent) =>
axios.request({
method: 'get',
url: getIronicBaseUrl(`nodes/${nodeIdent}/validate`),
});
/**
* List Ports by Node
* @param {String} nodeIdent The UUID or Name of the node.
* @returns {Promise}
*/
export const fetchNodePortsOnIronic = (nodeIdent) =>
axios.request({
method: 'get',
url: getIronicBaseUrl(`nodes/${nodeIdent}/ports`),
});
/**
* Change Node Provision State
* @param {String} nodeIdent The UUID or Name of the node.
* @param {Object} data request body
* @param {String} data.target The requested provisioning state of this Node.
* @param {String | Object} data.configdrive A config drive to be written to a partition on the Nodes boot disk.
* @param {Array} data.clean_steps An ordered list of cleaning steps that will be performed on the node.
* @param {Array} data.deploy_steps A list of deploy steps that will be performed on the node.
* @param {String} data.rescue_password Non-empty password used to configure rescue ramdisk during node rescue operation.
* @param {Boolean} data.disable_ramdisk If set to true, the ironic-python-agent ramdisk will not be booted for cleaning.
* @returns {Promise}
*/
export const changeNodeProvisionStateOnIronic = (nodeIdent, data) =>
axios.request({
method: 'put',
url: getIronicBaseUrl(`nodes/${nodeIdent}/states/provision`),
data,
});
/**
* Change Node Power State
* @param {String} nodeIdent The UUID or Name of the node.
* @param {Object} data request body
* @param {String} data.target Avaliable value : “power on”, “power off”, “rebooting”, “soft power off” or “soft rebooting”.
* @param {Number} data.timeout Timeout (in seconds) for a power state transition.
* @returns {Promise}
*/
export const changeNodePowerStateOnIronic = (nodeIdent, data) =>
axios.request({
method: 'put',
url: getIronicBaseUrl(`nodes/${nodeIdent}/states/power`),
data,
});
/**
* Set Maintenance Flag
* @param {String} nodeIdent The UUID or Name of the node.
* @param {Object} data request body
* @param {String} data.reason Specify the reason for setting the Node into maintenance mode.
* @returns {Promise}
*/
export const setMaintenanceFlagOnIronic = (nodeIdent, data) =>
axios.request({
method: 'put',
url: getIronicBaseUrl(`nodes/${nodeIdent}/maintenance`),
data,
});
/**
* Clear Maintenance Flag
* @param {String} nodeIdent The UUID or Name of the node.
* @returns {Promise}
*/
export const deleteMaintenanceFlagOnIronic = (nodeIdent) =>
axios.request({
method: 'delete',
url: getIronicBaseUrl(`nodes/${nodeIdent}/maintenance`),
});
/**
* Get Boot Device
* @param {String} nodeIdent The UUID or Name of the node.
* @returns {Promise}
*/
export const fetchBootDeviceOnIronic = (nodeIdent) =>
axios.request({
method: 'get',
url: getIronicBaseUrl(`nodes/${nodeIdent}/management/boot_device`),
});
/**
* Set Boot Device
* @param {String} nodeIdent The UUID or Name of the node.
* @param {Object} data request body
* @param {String} data.boot_device The boot device for a Node, eg. “pxe” or “disk”.
* @param {String} data.persistent Whether the boot device should be set only for the next reboot, or persistently.
* @returns {Promise}
*/
export const setBootDeviceOnIronic = (nodeIdent, data) =>
axios.request({
method: 'put',
url: getIronicBaseUrl(`nodes/${nodeIdent}/management/boot_device`),
data,
});
/**
* Get Supported Boot Devices
* @param {String} nodeIdent The UUID or Name of the node.
* @returns {Promise}
*/
export const fetchBootDeviceSupportedOnIronic = (nodeIdent) =>
axios.request({
method: 'get',
url: getIronicBaseUrl(
`nodes/${nodeIdent}/management/boot_device/supported`
),
});
/**
* Set all traits of a node
* @param {String} nodeIdent The UUID or Name of the node.
* @param {Object} data request body
* @param {Object} data.traits List of traits for this node.
* @returns {Promise}
*/
export const setAllTraitsOnIronic = (nodeIdent, data) =>
axios.request({
method: 'put',
url: getIronicBaseUrl(`nodes/${nodeIdent}/traits`),
data,
});

View File

@@ -1,51 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getIronicBaseUrl from './base';
/**
* Create Portgroup
* @param {Object} data request body
* @param {String} data.node_uuid UUID of the Node this resource belongs to.
* @param {String} data.address Physical hardware address of this network Port.
* @param {String} data.name Human-readable identifier for the Portgroup resource. May be undefined.
* @param {Object} data.mode Mode of the port group.
* @param {Boolean} data.standalone_ports_supported Indicates whether ports that are members of this portgroup can be used as stand-alone ports.
* @param {String} data.properties Key/value properties related to the port groups configuration.
* @param {String} data.extra A set of one or more arbitrary metadata key and value pairs.
* @param {String} data.uuid The UUID for the resource.
* @see https://docs.openstack.org/api-ref/baremetal/?expanded=set-all-traits-of-a-node-detail,create-portgroup-detail
*/
export const createPortGroupOnIronic = (data) =>
axios.request({
method: 'post',
url: getIronicBaseUrl('portgroups'),
data,
});
/**
* Update a Port
* @param {String} portId The UUID of the port.
* @param {Object} data request body
* @see https://docs.openstack.org/api-ref/baremetal/?expanded=set-all-traits-of-a-node-detail,update-a-portgroup-detail
* @returns {Promise}
*/
export const updatePortGroupOnIronic = (portgroupIdent, data) =>
axios.request({
method: 'patch',
url: getIronicBaseUrl(`portgroups/${portgroupIdent}`),
data,
});

View File

@@ -1,63 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getIronicBaseUrl from './base';
/**
* List Detailed Ports
* @param {Object} params request query
* @param {String} params.node Filter the list of returned Ports.
*/
export const fetchDetailedPortsOnIronic = (params) =>
axios.request({
method: 'get',
url: getIronicBaseUrl('ports'),
params,
});
/**
* Create Port
* @param {Object} data request body
* @param {String} data.node_uuid UUID of the Node this resource belongs to.
* @param {String} data.address Physical hardware address of this network Port.
* @param {String} data.portgroup_uuid UUID of the Portgroup this resource belongs to.
* @param {Object} data.local_link_connection The Port binding profile.
* @param {Boolean} data.pxe_enabled Indicates whether PXE is enabled or disabled on the Port.
* @param {String} data.physical_network The name of the physical network to which a port is connected. May be empty.
* @param {String} data.extra A set of one or more arbitrary metadata key and value pairs.
* @param {Boolean} data.is_smartnicIndicates whether the Port is a Smart NIC port.
* @param {String} data.uuid The UUID for the resource.
*/
export const createPortsOnIronic = (data) =>
axios.request({
method: 'post',
url: getIronicBaseUrl('ports'),
data,
});
/**
* Update a Port
* @param {String} portId The UUID of the port.
* @param {Object} data request body
* @see https://docs.openstack.org/api-ref/baremetal/?expanded=set-all-traits-of-a-node-detail,update-a-port-detail
* @returns {Promise}
*/
export const updatePortsOnIronic = (portId, data) =>
axios.request({
method: 'patch',
url: getIronicBaseUrl(`ports/${portId}`),
data,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { keystoneBase } from 'client/client/constants';
const getKeystoneBaseUrl = (key) => `${keystoneBase()}/${key}`;
export default getKeystoneBaseUrl;

View File

@@ -1,134 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getKeystoneBaseUrl from './base';
/**
* List domains
* @returns {Promise}
*/
export const fetchDomains = () =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl('domains'),
});
/**
* Show domain details
* @param {String} domainId The domain ID.
* @returns {Promise}
*/
export const fetchDomainDetails = (domainId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`domains/${domainId}`),
});
/**
* Update domain
* @param {String} domainId The domain ID.
* @param {Object} data request body
* @param {Object} data request body
* @returns {Promise}
*/
export const updateDomain = (domainId, data) =>
axios.request({
method: 'patch',
url: getKeystoneBaseUrl(`domains/${domainId}`),
data,
});
/**
* List role assignments for user on domain
* @param {String} domainId The domain ID.
* @param {String} userId The user ID.
* @returns {Promise}
*/
export const fetchRolesOnDomain = (domainId, userId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`domains/${domainId}/users/${userId}/roles`),
});
/**
* Assign role to user on domain
* @param {String} domainId The domain ID.
* @param {String} userId The user ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const updateRoleOnDomain = (domainId, userId, roleId) =>
axios.request({
method: 'put',
url: getKeystoneBaseUrl(
`domains/${domainId}/users/${userId}/roles/${roleId}`
),
});
/**
* Unassigns role from user on domain
* @param {String} domainId The domain ID.
* @param {String} userId The user ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const deleteRoleOnDomain = (domainId, userId, roleId) =>
axios.request({
method: 'delete',
url: getKeystoneBaseUrl(
`domains/${domainId}/users/${userId}/roles/${roleId}`
),
});
/**
* List role assignments for group on domain
* @param {String} domainId The domain ID.
* @param {String} groupId The group ID.
* @returns {Promise}
*/
export const fetchRolesForGroupOnDomain = (domainId, groupId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`domains/${domainId}/groups/${groupId}/roles`),
});
/**
* Assign role to group on domain
* @param {String} domainId The domain ID.
* @param {String} groupId The group ID.
* @returns {Promise}
*/
export const assignRoleForGroupOnDomain = (domainId, groupId, roleId) =>
axios.request({
method: 'put',
url: getKeystoneBaseUrl(
`domains/${domainId}/groups/${groupId}/roles/${roleId}`
),
});
/**
* Assign role to group on domain
* @param {String} domainId The domain ID.
* @param {String} groupId The group ID.
* @returns {Promise}
*/
export const unassignRoleForGroupOnDomain = (domainId, groupId, roleId) =>
axios.request({
method: 'delete',
url: getKeystoneBaseUrl(
`domains/${domainId}/groups/${groupId}/roles/${roleId}`
),
});

View File

@@ -1,113 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getKeystoneBaseUrl from './base';
/**
* List groups
* @param {String} groupId path
* @param {Object} parmas request query
* @param {String} parmas.name Filters the response by a group name.
* @param {String} parmas.domain_id Filters the response by a domain ID.
* @returns {Promise}
*/
export const fetchGroups = (parmas) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl('groups'),
parmas,
});
/**
* Show group details
* @param {String} groupId path
* @returns {Promise}
*/
export const fetchGroupDetails = (groupId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`groups/${groupId}`),
});
/**
* List users in group
* @param {String} groupId path
* @param {Object} parmas request query
* @param {String} parmas.password_expires_at Filter results based on which user passwords have expired.
* @returns {Promise}
*/
export const fetchGroupUsers = (groupId, parmas) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`groups/${groupId}/users`),
parmas,
});
/**
* Remove user from group
* @param {String} groupId The group ID.
* @param {String} userId The user ID.
* @returns {Promise}
*/
export const deleteGroupUsers = (groupId, userId) =>
axios.request({
method: 'delete',
url: getKeystoneBaseUrl(`groups/${groupId}/users/${userId}`),
});
/**
* Add user to group
* @param {String} groupId The group ID.
* @param {String} userId The user ID.
* @returns {Promise}
*/
export const addGroupUsers = (groupId, userId) =>
axios.request({
method: 'put',
url: getKeystoneBaseUrl(`groups/${groupId}/users/${userId}`),
});
/**
* Create group
* @param {Object} data request body
* @param {Object} data.group request body
* @param {Object} data.group.description The description of the group.
* @param {Object} data.group.domain_id The ID of the domain of the group.
* @param {Object} data.group.name The name of the group.
* @returns {Promise}
*/
export const createGroup = (groupId, data) =>
axios.request({
method: 'post',
url: getKeystoneBaseUrl('groups'),
data,
});
/**
* Update group
* @param {Object} data request body
* @param {Object} data.group request body
* @param {Object} data.group.description The description of the group.
* @param {Object} data.group.domain_id The ID of the domain of the group.
* @param {Object} data.group.name The name of the group.
* @returns {Promise}
*/
export const updateGroup = (groupId, data) =>
axios.request({
method: 'patch',
url: getKeystoneBaseUrl(`groups/${groupId}`),
data,
});

View File

@@ -1,170 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getKeystoneBaseUrl from './base';
/**
* List projects
* @returns {Promise}
*/
export const fetchProjects = () =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl('projects'),
});
/**
* Show project details
* @param {String} projectId path
* @returns {Promise}
*/
export const fetchProject = (projectId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`projects/${projectId}`),
});
/**
* Create project
* @param {Object} data request body
* @param {Object} data.project A project object
* @param {String} data.project.name The name of the project, which must be unique within the owning domain
* @param {Boolean} data.project.domain_id The ID of the domain for the project.
* @param {String} data.project.description The description of the project.
* @param {Boolean} data.project.enabled If set to true, project is enabled. If set to false, project is disabled.
* @returns {Promise}
*/
export const createProject = (data) =>
axios.request({
method: 'post',
url: getKeystoneBaseUrl('projects}'),
data,
});
/**
* Update project
* @param {String} projectId The project ID.
* @param {Object} data request body
* @param {Object} data.project A project object
* @param {String} data.project.name The name of the project
* @param {String} data.project.description The description of the project.
* @param {Boolean} data.project.enabled If set to true, project is enabled. If set to false, project is disabled.
* @returns {Promise}
*/
export const updateProject = (projectId, data) =>
axios.request({
method: 'patch',
url: getKeystoneBaseUrl(`projects/${projectId}`),
data,
});
/**
* List role assignments for user on project
* @param {String} projectId projects id
* @param {String} userId users id
* @returns {Promise}
*/
export const fetchRolesOnProject = (projectId, userId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`projects/${projectId}/users/${userId}/roles`),
});
/**
* List role assignments for group on project
* @param {String} projectId projects id
* @param {String} groupId groups id
* @returns {Promise}
*/
export const fetchRolesForGroupOnProject = (projectId, groupId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`projects/${projectId}/groups/${groupId}/roles`),
});
/**
* Modify tag list for a project
* @param {String} projectId The project ID.
* @param {Object} data request body
* @param {Array[String]} data.tags example : ["foo", "bar"]
* @returns {Promise}
*/
export const updateTagsOnProject = (projectId, data) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`projects/${projectId}/tags`),
data,
});
/**
* Assign role to group on project
* @param {String} projectId The project ID.
* @param {String} groupId The group ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const assignRoleToGroupOnProject = (projectId, groupId, roleId) =>
axios.request({
method: 'put',
url: getKeystoneBaseUrl(
`projects/${projectId}/groups/${groupId}/roles/${roleId}`
),
});
/**
* Assign role to group on project
* @param {String} projectId The project ID.
* @param {String} groupId The group ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const unassignRoleToGroupOnProject = (projectId, groupId, roleId) =>
axios.request({
method: 'delete',
url: getKeystoneBaseUrl(
`projects/${projectId}/groups/${groupId}/roles/${roleId}`
),
});
/**
* Assign role to user on project
* @param {String} projectId The project ID.
* @param {String} userId The user ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const assignRoleToUserOnProject = (projectId, userId, roleId) =>
axios.request({
method: 'put',
url: getKeystoneBaseUrl(
`projects/${projectId}/users/${userId}/roles/${roleId}`
),
});
/**
* Unassign role from user on project
* @param {String} projectId The project ID.
* @param {String} userId The user ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const unassignRoleToUserOnProject = (projectId, userId, roleId) =>
axios.request({
method: 'delete',
url: getKeystoneBaseUrl(
`projects/${projectId}/users/${userId}/roles/${roleId}`
),
});

View File

@@ -1,27 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getKeystoneBaseUrl from './base';
/**
* List role assignments
* @returns {Promise}
*/
export const fetchRoleAssignments = () =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl('role_assignments'),
});

View File

@@ -1,38 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getKeystoneBaseUrl from './base';
/**
* List roles
* @returns {Promise}
*/
export const fetchRoles = () =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl('roles'),
});
/**
* List implied (inference) roles for role
* @param {String} priorRoleId Role ID for a prior role.
* @returns {Promise}
*/
export const fetchImpliesForRole = (priorRoleId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`roles/${priorRoleId}/implies`),
});

View File

@@ -1,76 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getKeystoneBaseUrl from './base';
/**
* Assign a system role to a user
* @param {String} userId The user ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const updateSystemRole = (userId, roleId) =>
axios.request({
method: 'put',
url: getKeystoneBaseUrl(`system/users/${userId}/roles/${roleId}`),
});
/**
* Delete a system role assignment from a user
* @param {String} userId The user ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const deleteSystemRole = (userId, roleId) =>
axios.request({
method: 'delete',
url: getKeystoneBaseUrl(`system/users/${userId}/roles/${roleId}`),
});
/**
* List system role assignments for a group
* @param {String} groupId The group ID.
* @returns {Promise}
*/
export const fetchSystemRolesForGroup = (groupId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`system/groups/${groupId}/roles`),
});
/**
* Assign a system role to a group
* @param {String} groupId The group ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const assignSystemRoleForGroup = (groupId, roleId) =>
axios.request({
method: 'put',
url: getKeystoneBaseUrl(`system/groups/${groupId}/roles/${roleId}`),
});
/**
* Assign a system role to a group
* @param {String} groupId The group ID.
* @param {String} roleId The role ID.
* @returns {Promise}
*/
export const unassignSystemRoleForGroup = (groupId, roleId) =>
axios.request({
method: 'delete',
url: getKeystoneBaseUrl(`system/groups/${groupId}/roles/${roleId}`),
});

View File

@@ -1,126 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getKeystoneBaseUrl from './base';
/**
* List users
* @param {Object} params request query
* @param {String} params.domain_id Filters the response by a domain ID.
* @param {String} params.enabled Filters the response by either enabled (true) or disabled (false) users.
* @param {String} params.idp_id Filters the response by an identity provider ID.
* @param {String} params.name Filters the response by a user name.
* @param {String} params.password_expires_at Filter results based on which user passwords have expired.
* @param {String} params.protocol_id Filters the response by a protocol ID.
* @param {String} params.unique_id Filters the response by a unique ID.
* @returns {Promise}
*/
export const fetchUsers = () =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl('users'),
});
/**
* Show user details
* @param {String} userId The user ID.
* @returns {Promise}
*/
export const fetchUserDetails = (userId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`users/${userId}`),
});
/**
* Create user
* @param {Object} data request body
* @param {Object} data.user A user object
* @param {String} data.user.id id
* @param {String} data.user.domain_id The ID of the domain of the user, Default value : "default"
* @param {String} data.user.name The name for the user.
* @param {String} data.user.email The email for the user.
* @param {String} data.user.password The password for the user.
* @param {String} data.user.phone The phone for the user.
* @param {String} data.user.real_name The real name for the user.
* @param {Boolean} data.user.enabled Default value : true
* @param {String} data.user.description The description for the user.
* @returns {Promise}
*/
export const createUser = (data) =>
axios.request({
method: 'post',
url: getKeystoneBaseUrl('users'),
data,
});
/**
* Update user
* @param {String} userId The user ID.
* @param {Object} data request body
* @param {Object} data.user A user object
* @param {String} data.user.name The name for the user.
* @param {String} data.user.email The email for the user.
* @param {String} data.user.phone The phone for the user.
* @param {String} data.user.real_name The real name for the user.
* @param {String} data.user.description The description for the user.
* @returns {Promise}
*/
export const updateUser = (userId, data) =>
axios.request({
method: 'patch',
url: getKeystoneBaseUrl(`users/${userId}`),
data,
});
/**
* Change password for user
* @param {String} userId The user ID.
* @param {Object} data request body
* @param {Object} data.user A user object
* @param {String} data.user.original_password The original password for the user.
* @param {String} data.user.password The new password for the user.
* @returns {Promise}
*/
export const changeUserPassword = (userId, data) =>
axios.request({
method: 'post',
url: getKeystoneBaseUrl(`users/${userId}/password`),
data,
});
/**
* List projects for user
* @param {String} userId The user ID.
* @param {Object} params request query
* @returns {Promise}
*/
export const fetchUserProjects = (userId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`users/${userId}/projects`),
});
/**
* List groups to which a user belongs
* @param {String} userId The user ID.
* @returns {Promise}
*/
export const fetchUserGroups = (userId) =>
axios.request({
method: 'get',
url: getKeystoneBaseUrl(`users/${userId}/groups`),
});

View File

@@ -1,79 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* List agents
* @returns {Promise}
*/
export const fetchAgents = () =>
axios.request({
method: 'get',
url: getNeutronBaseUrl('agents'),
});
/**
* Schedule a network to a DHCP agent
* @param {String} agentId The ID of the agent.
* @param {Object} data request body
* @param {String} data.network_id The ID of the network.
* @returns {Promise}
*/
export const addNetworkToDhcpAgent = (agentId, data) =>
axios.request({
method: 'post',
url: getNeutronBaseUrl(`agents/${agentId}/dhcp-networks`),
data,
});
/**
* Remove network from a DHCP agent
* @param {String} agentId The ID of the agent.
* @param {String} networkId The ID of the network.
* @returns {Promise}
*/
export const deleteNetworkToDhcpAgent = (agentId, networkId) =>
axios.request({
method: 'delete',
url: getNeutronBaseUrl(`agents/${agentId}/dhcp-networks/${networkId}`),
});
/**
* Schedule router to an l3 agent
* @param {String} agentId The ID of the agent.
* @param {Object} data request body
* @param {String} data.router_id The ID of the router.
* @returns {Promise}
*/
export const addRoterToL3Agent = (agentId, data) =>
axios.request({
method: 'post',
url: getNeutronBaseUrl(`agents/${agentId}/l3-routers`),
data,
});
/**
* Remove l3 router from an l3 agent
* @param {String} agentId The ID of the agent.
* @param {String} routerId The ID of the router.
* @returns {Promise}
*/
export const deleteL3RouterFromL3Agent = (agentId, routerId) =>
axios.request({
method: 'delete',
url: getNeutronBaseUrl(`agents/${agentId}/l3-routers/${routerId}`),
});

View File

@@ -1,32 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* List all availability zones
* @param {Object} params request query
* @param {String} params.state Filter the list result by the state of the availability zone, which is either available or unavailable.
* @param {String} params.resource Filter the list result by the resource type of the availability zone.
* @param {String} params.name Filter the list result by the human-readable name of the resource.
* @returns {Promise}
*/
export const fetchListAvailabilityZonesOnNeutron = (params) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl('availability_zones'),
params,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { neutronBase } from 'client/client/constants';
const getNeutronBaseUrl = (key) => `${neutronBase()}/${key}`;
export default getNeutronBaseUrl;

View File

@@ -1,27 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* List extensions
* @returns {Promise}
*/
export const fetchListExtensionsOnNeutron = () =>
axios.request({
method: 'get',
url: getNeutronBaseUrl('extensions'),
});

View File

@@ -1,89 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* Update floating IP
* @param {String} floatingipId The ID of the floating IP address.
* @param {Object} data request body
* @param {Object} data.floatingip A floatingip object.
* @param {String} data.floatingip.port_id The ID of a port associated with the floating IP.
* @param {String} data.floatingip.fixed_ip_address The fixed IP address that is associated with the floating IP.
* @param {String} data.floatingip.description A human-readable description for the resource. Default is an empty string.
* @returns {Promise}
*/
export const updateFloatingIp = (floatingipId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`floatingips/${floatingipId}`),
data,
});
/**
* List floating IPs
* @param {String} floatingipId The ID of the floating IP address.
* @param {Object} query request query
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-floating-ips-detail#floating-ips-floatingips
* @returns {Promise}
*/
export const fetchListFloatingIps = (floatingipId, params) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`floatingips/${floatingipId}`),
params,
});
/**
* List floating IP port forwardings
* @param {String} floatingipId The ID of the floating IP address.
* @param {Object} query request query
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-floating-ips-detail,list-floating-ip-port-forwardings-detail#floating-ips-floatingips
* @returns {Promise}
*/
export const fetchListPortForwardings = (floatingipId, params) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`floatingips/${floatingipId}`),
params,
});
/**
* Create port forwarding
* @param {String} floatingipId The ID of the floating IP address.
* @param {Object} data request body
* @param {Object} data.port_forwarding A floating IP port forwarding object.
* @returns {Promise}
*/
export const createPortForwarding = (floatingipId, data) =>
axios.request({
method: 'post',
url: getNeutronBaseUrl(`floatingips/${floatingipId}/port_forwardings`),
data,
});
/**
* Delete a floating IP port forwarding
* @param {String} floatingipId The ID of the floating IP address.
* @param {String} portForwardingId The ID of the floating IP port forwarding.
*/
export const deletePortForwarding = (floatingipId, portForwardingId) =>
axios.request({
method: 'delete',
url: getNeutronBaseUrl(
`floatingips/${floatingipId}/port_forwardings/${{ portForwardingId }}`
),
});

View File

@@ -1,72 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* List networks
* @param {Object} params request query
* @param {Boolean} params.admin_state_up Filter the list result by the administrative state of the resource, which is up (true) or down (false).
* @param {Number} params.mtu Filter the network list result by the maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
* @param {String} params.name Filter the list result by the human-readable name of the resource.
* @param {String} params.project_id Filter the list result by the ID of the project that owns the resource.
* @param {String} params['provider:network_type'] Filter the list result by the type of physical network that this network/segment is mapped to.
* @param {String} params['provider:physical_network'] Filter the list result by the physical network where this network/segment is implemented.
* @param {String} params['provider:segmentation_id'] Filter the list result by the ID of the isolated segment on the physical network.
* @param {String} params.revision_number Filter the list result by the revision number of the resource.
* @param {Boolean} params.shared Filter the network list result based on if the network is shared across all tenants.
* @param {String} params.status Filter the network list result by network status. Values are ACTIVE, DOWN, BUILD or ERROR.
* @returns {Promise}
*/
export const fetchNetworksOnNeutron = (params) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl('networks'),
params,
});
/**
* List DHCP agents hosting a network
* @param {String} networkId The ID of the attached network.
* @returns {Promise}
*/
export const fetchListDhcpAgentsOnNeutron = (networkId) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`networks/${networkId}/dhcp-agents`),
});
/**
* Show network details
* @param {String} networkId The ID of the attached network.
* @returns {Promise}
*/
export const fetchNetworkDetailsOnNeutron = (networkId) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`networks/${networkId}`),
});
/**
* Show Network IP Availability
* @param {String} networkId The ID of the attached network.
* @returns {Promise}
*/
export const fetchNetworkIpAvailabilityDetailsOnNeutron = (networkId) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`network-ip-availabilities/${networkId}`),
});

View File

@@ -1,58 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* List ports
* @param {Object} params request query
* @param {String} params.device_id Filter the port list result by the ID of the device that uses this port.
* @param {String} params.device_owner Filter the port result list by the entity type that uses this port.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-ports-detail#ports
*/
export const fetchPortsOnNeutron = (params) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl('ports'),
params,
});
/**
* Update port
* @param {String} portId The ID of the port.
* @param {Object} data request body
* @param {String} data.port A port object.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=update-port-detail#ports
*/
export const updatePortOnNeutron = (portId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`ports/${portId}`),
data,
});
/**
* Create port
* @param {Object} data request body
* @param {String} data.port A port object.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=create-port-detail#ports
*/
export const createPortOnNeutron = (data) =>
axios.request({
method: 'post',
url: getNeutronBaseUrl('ports'),
data,
});

View File

@@ -1,144 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* Update QoS policy
* @param {String} policyId The ID of the QoS policy.
* @param {Object} data request body
* @param {Object} data.policy A QoS policy object.
* @param {String} data.policy.description A human-readable description for the resource. Default is an empty string.
* @param {Boolean} data.policy.is_default If true, the QoS policy is the default policy.
* @param {Boolean} data.policy.shared Set to true to share this policy with other projects. Default is false.
* @param {String} data.policy.name Human-readable name of the resource.
* @returns {Promise}
*/
export const updateQosPolicy = (policyId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`qos/policies/${policyId}`),
data,
});
/**
* Create bandwidth limit rule
* @param {String} policyId The ID of the QoS policy.
* @param {Object} data request body
* @param {Object} data.bandwidth_limit_rule A bandwidth_limit_rule object.
* @param {Number} data.bandwidth_limit_rule.max_kbps The maximum KBPS (kilobits per second) value.
* @param {Number} data.bandwidth_limit_rule.max_burst_kbps The maximum burst size (in kilobits). Default is 0.
* @param {Boolean} data.bandwidth_limit_rule.direction Valid values are egress and ingress. Default value is egress.
* @returns {Promise}
*/
export const createBandwidthLimitRulesQosPolicy = (policyId, data) =>
axios.request({
method: 'post',
url: getNeutronBaseUrl(`qos/policies/${policyId}/bandwidth_limit_rules`),
data,
});
/**
* Update bandwidth limit rule
* @param {String} policyId The ID of the QoS policy.
* @param {Object} ruleId The ID of the QoS rule.
* @param {Object} data request body
* @param {Object} data.bandwidth_limit_rule A bandwidth_limit_rule object.
* @param {Number} data.bandwidth_limit_rule.max_kbps The maximum KBPS (kilobits per second) value.
* @param {Number} data.bandwidth_limit_rule.max_burst_kbps The maximum burst size (in kilobits). Default is 0.
* @param {Boolean} data.bandwidth_limit_rule.direction Valid values are egress and ingress. Default value is egress.
* @returns {Promise}
*/
export const updateBandwidthLimitRulesQosPolicy = (policyId, ruleId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(
`qos/policies/${policyId}/bandwidth_limit_rules/${ruleId}`
),
data,
});
/**
* Delete bandwidth limit rule
* @param {String} policyId The ID of the QoS policy.
* @param {Object} ruleId The ID of the QoS rule.
* @returns {Promise}
*/
export const deleteBandwidthLimitRulesQosPolicy = (policyId, ruleId) =>
axios.request({
method: 'delete',
url: getNeutronBaseUrl(
`qos/policies/${policyId}/bandwidth_limit_rules/${ruleId}`
),
});
/**
* Create DSCP marking rule
* @param {String} policyId The ID of the QoS policy.
* @param {Object} data request body
* @param {Object} data.dscp_marking_rule A dscp_marking_rule object.
* @param {Number} data.dscp_marking_rule.dscp_mark The DSCP mark value.
* @returns {Promise}
*/
export const createDscpMarkingRuleQosPolicy = (policyId, data) =>
axios.request({
method: 'post',
url: getNeutronBaseUrl(`qos/policies/${policyId}/dscp_marking_rules`),
data,
});
/**
* Update DSCP marking rule
* @param {String} policyId The ID of the QoS policy.
* @param {String} dscpRuleId The ID of the DSCP rule.
* @param {Object} data request body
* @param {Object} data.dscp_marking_rule A dscp_marking_rule object.
* @param {Number} data.dscp_marking_rule.dscp_mark The DSCP mark value.
* @returns {Promise}
*/
export const updateDscpMarkingRuleQosPolicy = (policyId, dscpRuleId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(
`qos/policies/${policyId}/dscp_marking_rules/${dscpRuleId}`
),
data,
});
/**
* Delete DSCP marking rule
* @param {String} policyId The ID of the QoS policy.
* @param {String} dscpRuleId The ID of the DSCP rule.
* @returns {Promise}
*/
export const deleteDscpMarkingRuleQosPolicy = (policyId, dscpRuleId) =>
axios.request({
method: 'delete',
url: getNeutronBaseUrl(
`qos/policies/${policyId}/dscp_marking_rules/${dscpRuleId}`
),
});
/**
* Show QoS policy details
* @param {String} policyId The ID of the QoS policy.
* @returns {Promise}
*/
export const fetchQosPolicieDetailsOnNeutron = (policyId) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`qos/policies/${policyId}`),
});

View File

@@ -1,49 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* Show quota details for a tenant
* @param {String} projectId The ID of the project.
* @returns {Promise}
*/
export const fetchQuotaDetails = (projectId) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`quotas/${projectId}/details`),
});
/**
* Update quota for a project
* @param {String} projectId The ID of the project.
* @param {Object} data request body
* @param {Object} data.quota A quota object.
* @param {String} data.quota.floatingip The number of floating IP addresses allowed for each project. A value of -1 means no limit.
* @param {String} data.quota.network The number of networks allowed for each project. A value of -1 means no limit.
* @param {String} data.quota.router The number of routers allowed for each project. A value of -1 means no limit.
* @param {String} data.quota.subnet The number of subnets allowed for each project. A value of -1 means no limit.
* @param {String} data.quota.security_group The number of security groups allowed for each project. A value of -1 means no limit.
* @param {String} data.quota.security_group_rule The number of security group rules allowed for each project. A value of -1 means no limit.
* @param {String} data.quota.firewall_group A firewall group can have a firewall policy for ingress traffic and/or a firewall policy for egress traffic.
* @returns {Promise}
*/
export const updateQuotaDetails = (projectId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`quotas/${projectId}`),
data,
});

View File

@@ -1,102 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* List routers
* @param {Object} params request query
* @param {String} params.project_id Filter the list result by the ID of the project that owns the resource.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-dhcp-agents-hosting-a-network-detail,show-subnet-details-detail,list-routers-detail#id5
* @returns {Promise}
*/
export const fetchListRoutersOnNeutron = (params) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl('routers'),
params,
});
/**
* Show router details
* @param {String} routerId The ID of the router.
* @returns {Promise}
*/
export const fetchRouterDetailsOnNeutron = (routerId) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`routers/${routerId}`),
});
/**
* Add extra routes to router
* @param {String} routerId The ID of the router.
* @param {Object} data request body
* @param {Object} data.router The router object.
* @param {Array} data.router.routes The extra routes configuration for L3 router.
* @returns {Promise}
*/
export const addExtraRoutesToRouterOnNeutron = (routerId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`routers/${routerId}/add_extraroutes`),
data,
});
/**
* Remove extra routes from router
* @param {String} routerId The ID of the router.
* @param {Object} data request body
* @param {Object} data.router The router object.
* @param {Array} data.router.routes The extra routes configuration for L3 router.
* @returns {Promise}
*/
export const removeExtraRoutesFromRouterOnNeutron = (routerId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`routers/${routerId}/remove_extraroutes`),
data,
});
/**
* Add interface to router
* @param {String} routerId The ID of the router.
* @param {Object} data request body
* @param {Object} data.subnet_id The ID of the subnet. One of subnet_id or port_id must be specified.
* @param {Array} data.port_id The ID of the port. One of subnet_id or port_id must be specified.
* @returns {Promise}
*/
export const addInterfaceToRouterOnNeutron = (routerId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`routers/${routerId}/add_router_interface`),
data,
});
/**
* Remove interface from router
* @param {String} routerId The ID of the router.
* @param {Object} data request body
* @param {Object} data.subnet_id The ID of the subnet. One of subnet_id or port_id must be specified.
* @param {Array} data.port_id The ID of the port. One of subnet_id or port_id must be specified.
* @returns {Promise}
*/
export const removeInterfaceFromRouterOnNeutron = (routerId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`routers/${routerId}/remove_router_interface`),
data,
});

View File

@@ -1,28 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* Show security group
* @param {securityGroupId} params The security group id
* @returns {Promise}
*/
export const fetchSecurityGroupsDetails = (securityGroupId) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`security-groups/${securityGroupId}`),
});

View File

@@ -1,69 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* List subnets
* @param {Object} params request query
* @returns {Promise}
*/
export const fetchListSubnetsOnNeutron = (params) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl('subnets'),
params,
});
/**
* Show subnet details
* @param {String} subnetId The ID of the subnet.
* @returns {Promise}
*/
export const fetchSubnetDetailsOnNeutron = (subnetId) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`subnets/${subnetId}`),
});
/**
* Create subnet
* @param {Object} data request body
* @param {Object} data.subnet A subnet object.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-dhcp-agents-hosting-a-network-detail,show-subnet-details-detail,list-routers-detail,create-subnet-detail#id5
* @returns {Promise}
*/
export const createSubnetOnNeutron = (data) =>
axios.request({
method: 'post',
url: getNeutronBaseUrl('subnets'),
data,
});
/**
* Update subnet
* @param {String} subnetId The ID of the subnet.
* @param {Object} data request body
* @param {Object} data.subnet A subnet object.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-ports-detail,update-subnet-detail#ports
* @returns {Promise}
*/
export const updateSubnetOnNeutron = (subnetId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`subnets/${subnetId}`),
data,
});

View File

@@ -1,108 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNeutronBaseUrl from './base';
/**
* Update IKE policy
* @param {String} ikepolicyId The ID of the IKE policy.
* @param {Object} data request body
* @param {Object} data.ikepolicy An ikepolicy object.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=update-ike-policy-detail#vpnaas-2-0-vpn-vpnservices-ikepolicies-ipsecpolicies-endpoint-groups-ipsec-site-connections
* @returns {Promise}
*/
export const updateIkePolicyOnNeutron = (ikepolicyId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`vpn/ikepolicies/${ikepolicyId}`),
data,
});
/**
* Update IPsec connection
* @param {String} connectionId The ID of the IPsec site-to-site connection.
* @param {Object} data request body
* @param {Object} data.ipsec_site_connection An ipsec_site_connection object.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=update-ipsec-connection-detail#vpnaas-2-0-vpn-vpnservices-ikepolicies-ipsecpolicies-endpoint-groups-ipsec-site-connections
* @returns {Promise}
*/
export const updateIpConnectionOnNeutron = (connectionId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`vpn/ipsec-site-connections/${connectionId}`),
data,
});
/**
* Show IPsec connection
* @param {String} connectionId The ID of the IPsec site-to-site connection.
* @param {Object} params request query
* @returns {Promise}
*/
export const fetchIpConnectionDetailsOnNeutron = (connectionId, params) =>
axios.request({
method: 'get',
url: getNeutronBaseUrl(`vpn/ipsec-site-connections/${connectionId}`),
params,
});
/**
* Update VPN endpoint group
* @param {String} endpointGroupId The ID of the VPN endpoint group.
* @param {Object} data request body
* @param {Object} data.endpoint_group An ipsec_site_connection object.
* @param {Object} data.endpoint_group.name Human-readable name of the resource. Default is an empty string.
* @param {Object} data.endpoint_group.description A human-readable description for the resource. Default is an empty string.
* @returns {Promise}
*/
export const updateEndpointGroupOnNeutron = (endpointGroupId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`vpn/endpoint-groups/${endpointGroupId}`),
data,
});
/**
* Update VPN service
* @param {String} serviceId The ID of the VPN service.
* @param {Object} data request body
* @param {Object} data.vpnservice A vpnservice object.
* @param {Object} data.vpnservice.name Human-readable name of the resource. Default is an empty string.
* @param {Object} data.vpnservice.description A human-readable description for the resource. Default is an empty string.
* @param {Boolean} data.vpnservice.admin_state_up The administrative state of the resource, which is up (true) or down (false).
* @returns {Promise}
*/
export const updateVpnServiceNeutron = (serviceId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`vpn/vpnservices/${serviceId}`),
data,
});
/**
* Update IPsec policy
* @param {String} ipsecpolicyId The ID of the IPsec policy.
* @param {Object} data request body
* @param {Object} data.ipsecpolicy An ipsecpolicy object.
* @see https://docs.openstack.org/api-ref/network/v2/index.html?expanded=update-ipsec-policy-detail#vpnaas-2-0-vpn-vpnservices-ikepolicies-ipsecpolicies-endpoint-groups-ipsec-site-connections
* @returns {Promise}
*/
export const updateIpsecPolicyOnNeutron = (ipsecpolicyId, data) =>
axios.request({
method: 'put',
url: getNeutronBaseUrl(`vpn/ipsecpolicies/${ipsecpolicyId}`),
data,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { novaBase } from 'client/client/constants';
const getNovaBaseUrl = (key) => `${novaBase()}/${key}`;
export default getNovaBaseUrl;

View File

@@ -1,116 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNovaBaseUrl from './base';
/**
* List Flavor Access Information For Given Flavor
* @param {String} flavorId The ID of the flavor.
* @returns {Promise}
*/
export const fetchFlavorAccessinfomation = (flavorId) =>
axios.request({
method: 'get',
url: getNovaBaseUrl(`flavors/${flavorId}/os-flavor-access`),
});
/**
* Create Flavor
* @param {Object} data request body
* @param {Object} data.flavor A flavor is a combination of memory, disk size, and CPUs.
* @param {String} data.flavor.name The display name of a flavor.
* @param {String} data.flavor.description A free form description of the flavor.
* @param {String} data.flavor.id The ID of the flavor.
* @param {Number} data.flavor.ram The amount of RAM a flavor has, in MiB.
* @param {Number} data.flavor.disk The size of the root disk that will be created in GiB.
* @param {Number} data.flavor.vcpus The number of virtual CPUs that will be allocated to the server.
* @param {Number} data.flavor.swap The size of a dedicated swap disk that will be allocated, in MiB.
* @param {Number} data.flavor['OS-FLV-EXT-DATA:ephemeral'] The size of the ephemeral disk that will be created, in GiB.
* @param {Number} data.flavor.rxtx_factor The receive / transmit factor (as a float) that will be set on ports if the network backend supports the QOS extension.
* @param {Boolean} data.flavor.['os-flavor-access:is_public'] Whether the flavor is public
* @returns {Promise}
*/
export const createFlavor = (data) =>
axios.request({
method: 'post',
url: getNovaBaseUrl('flavors'),
data,
});
/**
* Add Or Remove Flavor Access To Tenant
* @param {String} flavorId The ID of the flavor.
* @param {Object} data request body
* @param {Object} data.addTenantAccess The action.
* @param {String} data.addTenantAccess.tenant The UUID of the tenant in a multi-tenancy cloud.
* @param {String} data.removeTenantAccess The action.
* @param {String} data.removeTenantAccess.tenant The UUID of the tenant in a multi-tenancy cloud.
* @returns {Promise}
*/
export const addOrDeleteFlavorAccessToTenant = (flavorId, data) =>
axios.request({
method: 'post',
url: getNovaBaseUrl(`flavors/${flavorId}/action`),
data,
});
/**
* Create Extra Specs For A Flavor
* @param {String} flavorId The ID of the flavor.
* @param {Object} data request body
* @param {Object} data.extra_specs A dictionary of the flavors extra-specs key-and-value pairs.
* @param {String} data.extra_specs.key The extra spec key of a flavor.
* @param {String} data.extra_specs.value The extra spec value of a flavor.
* @returns {Promise}
*/
export const createExtraSpecsForFlavor = (flavorId, data) =>
axios.request({
method: 'post',
url: getNovaBaseUrl(`flavors/${flavorId}/os-extra_specs`),
data,
});
/**
* Update An Extra Spec For A Flavor
* @param {String} flavorId The ID of the flavor.
* @param {Object} flavorExtraSpecKey The extra spec key for the flavor.
* @param {Object} data request body
* @param {String} data.key The extra spec key of a flavor.
* @param {String} data.value The extra spec value of a flavor.
* @returns {Promise}
*/
export const updateExtraSpecsForFlavor = (flavorId, flavorExtraSpecKey, data) =>
axios.request({
method: 'put',
url: getNovaBaseUrl(
`flavors/${flavorId}/os-extra_specs/${flavorExtraSpecKey}`
),
data,
});
/**
* Delete An Extra Spec For A Flavor
* @param {String} flavorId The ID of the flavor.
* @param {Object} flavorExtraSpecKey The extra spec key for the flavor.
* @returns {Promise}
*/
export const deleteExtraSpecsForFlavor = (flavorId, flavorExtraSpecKey) =>
axios.request({
method: 'delete',
url: getNovaBaseUrl(
`flavors/${flavorId}/os-extra_specs/${flavorExtraSpecKey}`
),
});

View File

@@ -1,32 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNovaBaseUrl from './base';
/**
* Add Host, Remove Host, Create Or Update Aggregate Metadata
* @param {Object} data request body
* @param {Object} data.add_host when add host
* @param {Object} data.remove_host when remove host
* @param {Object} data.set_metadata when set metadata
* @returns {Promise}
*/
export const toggleChangeAggregate = (aggregateId, data) =>
axios.request({
method: 'get',
url: getNovaBaseUrl(`os-aggregates/${aggregateId}/action`),
data,
});

View File

@@ -1,38 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNovaBaseUrl from './base';
/**
* List Hypervisors Details
* @returns {Promise}
*/
export const fetchOsHypervisorsDetails = () =>
axios.request({
method: 'get',
url: getNovaBaseUrl('os-hypervisors/detail'),
});
/**
* Show Hypervisor Details
* @param {String} hypervisorId path
* @returns {Promise}
*/
export const fetchOsHypervisorDetails = (hypervisorId) =>
axios.request({
method: 'get',
url: getNovaBaseUrl(`os-hypervisors/${hypervisorId}`),
});

View File

@@ -1,45 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNovaBaseUrl from './base';
/**
* Show The Detail of Quota
* @returns {Promise}
*/
export const fetchOsQuotaSetsDetails = (tenantId) =>
axios.request({
method: 'get',
url: getNovaBaseUrl(`os-quota-sets/${tenantId}/detail`),
});
/**
* Update Quotas
* @param {String} tenantId The UUID of the tenant in a multi-tenancy cloud.
* @param {Object} data request body
* @param {Object} data.quota_set A quota object.
* @param {String} data.quota_set.instances The number of allowed servers for each tenant.
* @param {String} data.quota_set.cores The number of allowed server cores for each tenant.
* @param {String} data.quota_set.ram The amount of allowed server RAM, in MiB, for each tenant.
* @param {String} data.quota_set.server_groups The number of allowed server groups for each tenant.
* @returns {Promise}
*/
export const updateQuotaSets = (tenantId, data) =>
axios.request({
method: 'put',
url: getNovaBaseUrl(`os-quota-sets/${tenantId}`),
data,
});

View File

@@ -1,47 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNovaBaseUrl from './base';
/**
* List Compute Services
* @param {Object} params request query
* @param {String} params.binary Filter the service list result by binary name of the service. example : nova-compute
* @param {String} params.host Filter the service list result by the host name.
* @returns {Promise}
*/
export const fetchOsServices = (params) =>
axios.request({
method: 'get',
url: getNovaBaseUrl('os-services'),
params,
});
/**
* Update Compute Service
* @param {String} serviceId The id of the service as a uuid.
* @param {Object} data request body
* @param {String} data.status The status of the service. One of enabled or disabled.
* @param {String} data.disabled_reason The reason for disabling a service.
* @param {Boolean} data.forced_down forced_down is a manual override to tell nova that the service in question has been fenced manually by the operations team.
* @returns {Promise}
*/
export const updateComputeService = (serviceId, data) =>
axios.request({
method: 'put',
url: getNovaBaseUrl(`os-services/${serviceId}`),
data,
});

View File

@@ -1,202 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getNovaBaseUrl from './base';
/**
* Create server
* @param {Object} data request body
* @param {Object} data.server A server object
* @param {String} data.server.availability_zone availability_zone
* @param {Array[Object]} data.server.block_device_mapping_v2 example : [{boot_index:0,delete_on_termination:true,destination_type:"volume",source_type:"image",uuid:"66e129c5-7386-4620-b02a-8e578405e735",volume_size:10,volume_type:"9bcdbe9a-2e06-430f-a6a6-ba77c507cf51"}]
* @param {String} data.server.flavorRef The flavor reference, as an ID (including a UUID) or full URL, for the flavor for your server instance.
* @param {String} data.server.imageRef imageRef
* @param {String} data.server.key_name key_name
* @param {String} data.server.adminPass admins password
* @param {Number} data.server.min_count when count > 1
* @param {Number} data.server.max_count when count > 1
* @param {String} data.server.return_reservation_id when count > 1
* @param {String} data.server.name The server name
* @param {String} data.server.hypervisor_hostname when physicalNodeType.value !== "smart"
* @param {String} data.server.user_data Configuration information or scripts to use upon launch. Must be Base64 encoded. Restricted to 65535 bytes.
* @param {Object} data.server["OS-SCH-HNT:scheduler_hints"] example : {group: "xxxxx"}
* @param {Array[Object]} data.server.networks example : [{uuid: "xxxx"}]
* @param {Array[Object]} data.server.security_groups example : [{name: "xxxx"}]
* @returns {Promise}
*/
export const createServer = (data) =>
axios.request({
method: 'post',
url: getNovaBaseUrl('servers'),
data,
});
/**
* Delete server
* @param {String} id The UUID of the server.
* @returns {Promise}
*/
export const deleteServer = (id) =>
axios.request({
method: 'delete',
url: getNovaBaseUrl(`servers/${id}`),
});
/**
* List Servers
* @param {Object} params request query
* @param {String} params.reservation_id A reservation id as returned by a servers multiple create call.
* @returns {Promise}
*/
export const fetchListServersOnNova = (params) =>
axios.request({
method: 'get',
url: getNovaBaseUrl('servers'),
params,
});
/**
* Show Server Details
* @param {String} serverId The UUID of the server.
* @param {Object} params request query
* @returns {Promise}
*/
export const fetchServerDetails = (serverId, params) =>
axios.request({
method: 'get',
url: getNovaBaseUrl(`servers/${serverId}`),
params,
});
/**
* Create Console
* @param {String} serverId The UUID of the server.
* @param {Object} data request body
* @param {Object} data.remote_console The remote console object.
* @param {String} data.remote_console.protocol The protocol of remote console.
* @param {String} data.remote_console.type The type of remote console.
* @returns {Promise}
*/
export const createConsoleOnServer = (serverId, data) =>
axios.request({
method: 'post',
url: getNovaBaseUrl(`servers/${serverId}/remote-consoles`),
data,
});
/**
* Servers - run an administrative action
* @param {String} serverId The UUID of the server.
* @param {Object} data request body
* @param {String} data.injectNetworkInfo Inject Network Information (injectNetworkInfo Action
* @param {String} data.migrate The action to cold migrate a server.
* @returns {Promise}
*/
export const serverActionOnNova = (serverId, data) =>
axios.request({
method: 'post',
url: getNovaBaseUrl(`servers/${serverId}/action`),
data,
});
/**
* List Port Interfaces
* @param {String} serverId The UUID of the server.
* @returns {Promise}
*/
export const fetchListPortInterfaces = (serverId) =>
axios.request({
method: 'get',
url: getNovaBaseUrl(`servers/${serverId}/os-interface`),
});
/**
* Create Interface
* @param {String} serverId The UUID of the server.
* @param {Object} data request body
* @param {Object} data.interfaceAttachment Specify the interfaceAttachment action in the request body.
* @param {Object} data.ip_address The IP address. It is required when fixed_ips is specified.
* @param {Object} data.port_id The ID of the port for which you want to create an interface.
* @param {Object} data.net_id The ID of the network for which you want to create a port interface.
* @param {Object} data.fixed_ips Fixed IP addresses.
* @param {Object} data.tag A device role tag that can be applied to a network interface when attaching it to the VM.
* @returns {Promise}
*/
export const createOsInterfaces = (serverId, data) =>
axios.request({
method: 'post',
url: getNovaBaseUrl(`servers/${serverId}/os-interface`),
data,
});
/**
* Detach Interface
* @param {String} serverId The UUID of the server.
* @param {String} portId The UUID of the port.
* @returns {Promise}
*/
export const deletePortInterfaces = (serverId, portId) =>
axios.request({
method: 'delete',
url: getNovaBaseUrl(`servers/${serverId}/os-interface/${portId}`),
});
/**
* List volume attachments for an instance
* @param {String} serverId The UUID of the server.
* @param {Object} params request query
* @param {Number} params.limit max_limit
* @param {Number} params.offset offset is where to start in the list
* @returns {Promise}
*/
export const fetchVolumeAttachments = (serverId, params) =>
axios.request({
method: 'get',
url: getNovaBaseUrl(`servers/${serverId}/os-volume_attachments`),
params,
});
/**
* Attach a volume to an instance
* @param {String} serverId The UUID of the server.
* @param {Object} data The UUID of the port.
* @param {Object} data.volumeAttachment A dictionary representation of a volume attachment containing the fields device and volumeId.
* @param {Object} data.volumeAttachment.volumeId The UUID of the volume to attach.
* @param {Object} data.volumeAttachment.device Name of the device.
* @param {Object} data.volumeAttachment.tag A device role tag that can be applied to a volume when attaching it to the VM.
* @param {Boolean} data.volumeAttachment.delete_on_termination To delete the attached volume when the server is destroyed.
* @returns {Promise}
*/
export const attachVolumeOnInstance = (serverId, data) =>
axios.request({
method: 'post',
url: getNovaBaseUrl(`servers/${serverId}/os-volume_attachments}`),
data,
});
/**
* Detach a volume from an instance
* @param {String} serverId The UUID of the server.
* @param {Object} volumeId The UUID of the volume to detach.
* @returns {Promise}
*/
export const deleteVolumeOnInstance = (serverId, volumeId) =>
axios.request({
method: 'delete',
url: getNovaBaseUrl(
`servers/${serverId}/os-volume_attachments/${volumeId}}`
),
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { octaviaBase } from 'client/client/constants';
const getOctaviaBaseUrl = (key) => `${octaviaBase()}/${key}`;
export default getOctaviaBaseUrl;

View File

@@ -1,132 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getOctaviaBaseUrl from './base';
/**
* Update a Load Balancer
* @param {String} loadbalancerId The ID of the load balancer to query.
* @param {Object} data request body
* @param {Object} data.loadbalancer A load balancer object.
* @param {Boolean} data.loadbalancer.admin_state_up The administrative state of the resource, which is up (true) or down (false).
* @param {String} data.loadbalancer.name Human-readable name of the resource.
* @param {Array} data.loadbalancer.tags A list of simple strings assigned to the resource.
* @param {String} data.loadbalancer.vip_qos_policy_id The ID of the QoS Policy which will apply to the Virtual IP (VIP).
* @returns {Promise}
*/
export const updateLoadBalancer = (loadbalancerId, data) =>
axios.request({
method: 'put',
url: getOctaviaBaseUrl(`lbaas/loadbalancers/${loadbalancerId}`),
data,
});
/**
* List Load Balancers
* @param {Object} params request query
* @param {String} params.project_id The ID of the project to query.
* @param {String} params.fields A load balancer object.
* @returns {Promise}
*/
export const fetchListLoadBalancers = (params) =>
axios.request({
method: 'get',
url: getOctaviaBaseUrl('lbaas/loadbalancers'),
params,
});
/**
* Show Load Balancer details
* @param {String} loadbalancerId The ID of the load balancer to query.
* @param {Object} params request query
* @param {String} params.fields A load balancer object.
* @returns {Promise}
*/
export const fetchLoadBalancerDetails = (loadbalancerId, params) =>
axios.request({
method: 'get',
url: getOctaviaBaseUrl(`lbaas/loadbalancers/${loadbalancerId}`),
params,
});
/**
* Remove a Load Balancer
* @param {String} loadbalancerId The ID of the load balancer to query.
* @param {Object} params request query
* @param {Boolean} params.cascade If true will delete all child objects of the load balancer.
* @returns {Promise}
*/
export const deleteLoadBalancer = (loadbalancerId, params) =>
axios.request({
method: 'delete',
url: getOctaviaBaseUrl(`lbaas/loadbalancers/${loadbalancerId}`),
params,
});
/**
* Create Member
* @param {String} poolId The ID of the pool to query.
* @param {Object} data request body
* @param {Object} data.member The member object.
* @returns {Promise}
*/
export const createMemberOnOctavia = (poolId, data) =>
axios.request({
method: 'post',
url: getOctaviaBaseUrl(`lbaas/pools/${poolId}/members`),
data,
});
/**
* Batch Update Members
* @param {String} poolId The ID of the pool to query.
* @param {Object} data request body
* @param {Object} data.members The members object.
* @returns {Promise}
*/
export const batchUpdateMembersOnOctavia = (poolId, data) =>
axios.request({
method: 'put',
url: getOctaviaBaseUrl(`lbaas/pools/${poolId}/members`),
data,
});
/**
* Update A Member
* @param {String} poolId The ID of the pool to query.
* @param {String} memberId The ID of the member to query.
* @param {Object} data request body
* @param {Object} data.member The member object.
* @returns {Promise}
*/
export const updateAMemberOnOctavia = (poolId, memberId, data) =>
axios.request({
method: 'put',
url: getOctaviaBaseUrl(`lbaas/pools/${poolId}/members/${memberId}`),
data,
});
/**
* Delete A Member
* @param {String} poolId The ID of the pool to query.
* @param {String} memberId The ID of the member to query.
* @returns {Promise}
*/
export const deleteAMemberOnOctavia = (poolId, memberId) =>
axios.request({
method: 'delete',
url: getOctaviaBaseUrl(`lbaas/pools/${poolId}/members/${memberId}`),
});

View File

@@ -1,28 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getOctaviaBaseUrl from './base';
/**
* Show Pool Details
* @param {Object} poolId The ID of the pool to query.
* @returns {Promise}
*/
export const fetchPoolDetailsOnOctavia = (poolId) =>
axios.request({
method: 'get',
url: getOctaviaBaseUrl(`pools/${poolId}`),
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { pankoBase } from 'client/client/constants';
const getPankoBaseUrl = (key) => `${pankoBase()}/${key}`;
export default getPankoBaseUrl;

View File

@@ -1,50 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getPankoBaseUrl from './base';
/**
* List events
* @param {Object} params request query
* @param {String} params['q.field'] 'filter_self'
* @param {String} params['q.op'] 'le'
* @param {Boolean} params['q.value'] true or false
* @param {String} params.sort 'generated:desc'
* @param {Number} params.limit 10
* @param {String} params.mariker "string"
* @returns {Promise}
*/
export const fetchEvents = (params) =>
axios.request({
method: 'get',
url: getPankoBaseUrl('events'),
params,
});
/**
* Fetch count for event
* @param {Object} params request query
* @param {String} params['q.field'] 'filter_self'
* @param {String} params['q.op'] 'le'
* @param {Boolean} params['q.value'] true or false
* @returns {Promise}
*/
export const fetchEventCount = (params) =>
axios.request({
method: 'get',
url: getPankoBaseUrl('events/count'),
params,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { placementBase } from 'client/client/constants';
const getPlacementBaseUrl = (key) => `${placementBase()}/${key}`;
export default getPlacementBaseUrl;

View File

@@ -1,28 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getPlacementBaseUrl from './base';
/**
* List resource provider inventories
* @param {String} uuid path
* @returns {Promise}
*/
export const fetchResourceProviderInventories = (uuid) =>
axios.request({
method: 'get',
url: getPlacementBaseUrl(`resource_providers/${uuid}/inventories`),
});

View File

@@ -1,31 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getPlacementBaseUrl from './base';
/**
* List traits
* @param {Object} params request query
* @param {String} params.name A string to filter traits.
* @param {Boolean} params.associated Available values for the parameter are true and false.
* @returns {Promise}
*/
export const fetchListTraitsOnPlacement = (params) =>
axios.request({
method: 'get',
url: getPlacementBaseUrl('traits'),
params,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { skylineBase } from 'client/client/constants';
const getSkylineBaseUrl = (key) => `${skylineBase()}/${key}`;
export default getSkylineBaseUrl;

View File

@@ -1,47 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getSkylineBaseUrl from './base';
/**
* List Keystone Endpoints
* @returns {Promise}
*/
export const fetchKeystoneEndpoints = () =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('contrib/keystone_endpoints'),
});
/**
* List Domains
* @returns {Promise}
*/
export const fetchDomains = () =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('contrib/domains'),
});
/**
* List Regions
* @returns {Promise}
*/
export const fetchRegions = () =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('contrib/regions'),
});

View File

@@ -1,155 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getSkylineBaseUrl from './base';
/**
* List Servers.
* Notes:
* The host of sort_keys is only used for admin/system_admin role users.
* The name is to support for fuzzy queries.
* @param {Object} params request query
* @param {Number} params.limit Default value : 10
* @param {String} params.marker marker
* @param {String} params.sort_dirs Available values : desc, asc
* @param {Array[String]} params.sort_keys Available values : uuid, display_name, vm_state, locked, created_at, host, project_id
* @param {Boolean} params.all_projects Default value : false
* @param {String} params.project_id Only works when the all_projects filter is also specified.
* @param {String} params.project_name Only works when the all_projects filter is also specified.
* @param {String} params.name name
* @param {String} params.floating_ip Floating IP of server.
* @param {String} params.fixed_ip Fixed IP of server.
* @param {String} params.status Available values : ACTIVE, BUILD, ERROR, HARD_REBOOT, MIGRATING, PAUSED, REBOOT, REBUILD, RESCUE, RESIZE, SHELVED, SHELVED_OFFLOADED, SHUTOFF, SOFT_DELETED, SUSPENDED, UNKNOWN
* @param {String} params.host It will be ignored for non-admin user.
* @param {String} params.flavor_id flavors id
* @param {Array[String]} params.uuid UUID of server.
* @returns {Promise}
*/
export const fetchListServers = (params) =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('extension/servers'),
params,
});
/**
* List Recycle Servers.
* Notes:
* The updated_at of sort_keys is used as deleted_at.
* The name is to support for fuzzy queries.
* @param {Object} params request query
* @param {Number} params.limit Default value : 10
* @param {String} params.marker marker
* @param {String} params.sort_dirs Available values : desc, asc
* @param {Array[String]} params.sort_keys Available values : uuid, display_name, updated_at, project_id
* @param {Boolean} params.all_projects Default value : false
* @param {String} params.project_id Only works when the all_projects filter is also specified.
* @param {String} params.project_name Only works when the all_projects filter is also specified.
* @param {String} params.name name
* @param {String} params.floating_ip Floating IP of server.
* @param {String} params.fixed_ip Fixed IP of server.
* @param {Array[String]} params.uuid UUID of server.
* @returns {Promise}
*/
export const fetchListRecycleServers = (params) =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('extension/recycle_servers'),
params,
});
/**
* List Volumes.
* @param {Object} params request query
* @param {Number} params.limit Default value : 10
* @param {String} params.marker marker
* @param {String} params.sort_dirs Available values : desc, asc
* @param {Array[String]} params.sort_keys Available values : id, name, size, status, bootable, created_at
* @param {Boolean} params.all_projects Default value : false
* @param {String} params.project_id Only works when the all_projects filter is also specified.
* @param {String} params.name name
* @param {Boolean} params.multiattach Default value : false
* @param {String} params.status Available values : creating, available, reserved, attaching, detaching, in-use, maintenance, deleting, awaiting-transfer, error, error_deleting, backing-up, restoring-backup, error_backing-up, error_restoring, error_extending, downloading, uploading, retyping, extending
* @param {Boolean} params.bootable Default value : false
* @param {Array[String]} params.uuid UUID of volume.
* @returns {Promise}
*/
export const fetchListVolumes = (params) =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('extension/volumes'),
params,
});
/**
* List Volume Snapshots.
* @param {Object} params request query
* @param {Number} params.limit Default value : 10
* @param {String} params.marker marker
* @param {String} params.sort_dirs Available values : desc, asc
* @param {Array[String]} params.sort_keys Available values : id, name, status, created_at
* @param {Boolean} params.all_projects Default value : false
* @param {String} params.project_id Only works when the all_projects filter is also specified.
* @param {String} params.name name
* @param {String} params.status Available values : CREATING, AVAILABLE, DELETING, ERROR, ERROR_DELETING
* @param {String} params.volume_id volumes id
* @returns {Promise}
*/
export const fetchListVolumeSnapshots = (params) =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('extension/volume_snapshots'),
params,
});
/**
* List Ports.
* @param {Object} params request query
* @param {Number} params.limit Default value : 10
* @param {String} params.marker marker
* @param {String} params.sort_dirs Available values : desc, asc
* @param {Array[String]} params.sort_keys Available values : id, name, mac_address, status, project_id
* @param {Boolean} params.all_projects Default value : false
* @param {String} params.project_id Only works when the all_projects filter is also specified.
* @param {String} params.name name
* @param {String} params.status Available values : ACTIVE, DOWN, BUILD, ERROR, N/A
* @param {String} params.network_name networks name
* @param {String} params.network_id networks id
* @param {String} params.device_id devices id
* @param {Array[String]} params.device_owner Available values : , compute:nova, network:dhcp, network:floatingip, network:router_gateway, network:router_ha_interface, network:ha_router_replicated_interface
* @param {Array[String]} params.uuid UUID of port.
* @returns {Promise}
*/
export const fetchListPorts = (params) =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('extension/ports'),
params,
});
/**
* List compute services.
* @param {Object} params request query
* @param {String} params.binary binary
* @param {String} params.host host
* @returns {Promise}
*/
export const fetchListComputeServices = (params) =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('extension/compute-services'),
params,
});

View File

@@ -1,64 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getSkylineBaseUrl from './base';
/**
* login
* @param {Object} data request body
* @param {String} data.region RegionOne
* @param {String} data.domain default
* @param {String} data.username admin
* @param {String} data.password password
* @returns {Promise}
*/
export const login = (data) =>
axios.request({
method: 'post',
url: getSkylineBaseUrl('login'),
data,
});
/**
* logout
* @returns {Promise}
*/
export const logout = () =>
axios.request({
method: 'post',
url: getSkylineBaseUrl('logout'),
});
/**
* fetch profile
* @returns {Promise}
*/
export const fetchProfile = () =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('profile'),
});
/**
* switch_project
* @param {String} projectId projects id
* @returns {Promise}
*/
export const switchProject = (projectId) =>
axios.request({
method: 'post',
url: getSkylineBaseUrl(`switch_project/${projectId}`),
});

View File

@@ -1,40 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getSkylineBaseUrl from './base';
/**
* List policies
* @returns {Promise}
*/
export const fetchPolicies = () =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('policies'),
});
/**
* Check policies
* @param {Object} data request body
* @param {Array[String]} data.rules ["string"]
* @returns {Promise}
*/
export const checkPolicies = (data) =>
axios.request({
method: 'post',
url: getSkylineBaseUrl('policies/check'),
data,
});

View File

@@ -1,63 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
import getSkylineBaseUrl from './base';
/**
* Get a setting item.
* @param {String} key path
* @returns {Promise}
*/
export const fetchSetting = (key) =>
axios.request({
method: 'get',
url: getSkylineBaseUrl(`setting/${key}`),
});
/**
* Reset a setting item to default
* @param {String} key path
* @returns {Promise}
*/
export const resetSetting = (key) =>
axios.request({
method: 'delete',
url: getSkylineBaseUrl(`setting/${key}`),
});
/**
* Update a setting item.
* @param {Object} data request body
* @param {String} data.key "string"
* @param {String} data.value "string"
* @returns {Promise}
*/
export const updateSetting = (data) =>
axios.request({
method: 'put',
url: getSkylineBaseUrl('setting'),
data,
});
/**
* Get all settings.
* @returns {Promise}
*/
export const fetchAllSettings = () =>
axios.request({
method: 'get',
url: getSkylineBaseUrl('settings'),
});

View File

@@ -1,27 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import axios from '@/libs/axios';
/**
* Create Storageclasses
* @param {Object} data request body
* @returns {Promise}
*/
export const createStorageclasses = (data) =>
axios.request({
method: 'post',
url: 'apis/storage.k8s.io/v1/storageclasses',
data,
});

View File

@@ -1,23 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {String} key api url
* @returns {String}
*/
import { swiftBase } from 'client/client/constants';
const getSwiftBaseUrl = (key) => `${swiftBase()}/${key}`;
export default getSwiftBaseUrl;

View File

@@ -27,7 +27,7 @@ export default class BaseClient {
};
get request() {
const { request } = clientRequest;
const request = this.originRequest;
return {
get: (url, params, conf) => request.get(this.getUrl(url), params, conf),
post: (url, data, params, conf) =>

View File

@@ -19,7 +19,7 @@ export const groupNameVersionMap = {
system: 'v1',
};
const endpointVersionMap = {
export const endpointVersionMap = {
keystone: 'v3',
nova: 'v2.1',
cinder: 'v3',
@@ -28,21 +28,12 @@ const endpointVersionMap = {
ironic: 'v1',
ironicInspector: 'v1',
heat: 'v1',
swift: 'v1',
octavia: 'v2',
courier: 'v1',
prometheus: 'api/v1',
prometheus_sidecar: 'api/v1',
gocron: 'api',
panko: 'v2',
billing_system: 'api/core.io/v1',
workflow: 'api/core.io/v1',
};
const endpointsDefault = {
export const endpointsDefault = {
ironic: '/api/openstack/ironic',
ironicInspector: '/api/openstack/ironic-inspector',
swift: '/api/openstack/swift/swift',
octavia: '/api/openstack/octavia',
};
@@ -71,23 +62,9 @@ export const ironicInspectorBase = () =>
getOpenstackEndpoint('ironicInspector');
export const placementBase = () => getOpenstackEndpoint('placement');
export const heatBase = () => getOpenstackEndpoint('heat');
export const swiftBase = () => getOpenstackEndpoint('swift');
export const octaviaBase = () => getOpenstackEndpoint('octavia');
export const alertmanagerBase = () => getOpenstackEndpoint('alertmanager');
export const prometheusBase = () => getOpenstackEndpoint('prometheus');
export const prometheusSidecarBase = () =>
getOpenstackEndpoint('prometheus_sidecar');
export const courierBase = () => getOpenstackEndpoint('courier');
export const gocronBase = () => getOpenstackEndpoint('gocron');
export const pankoBase = () => getOpenstackEndpoint('panko');
export const s3Base = () => getOpenstackEndpoint('s3');
export const billingBase = () => getOpenstackEndpoint('billing_system');
export const workflowBase = () => getOpenstackEndpoint('workflow');
export const ironicOriginEndpoint = () => getOriginEndpoint('ironic');
export const s3OriginEndpoint = () => getOriginEndpoint('s3');
export const billingEndpoint = () => getOriginEndpoint('billing_system');
export const firewallEndpoint = () => getOriginEndpoint('neutron_firewall');
export const vpnEndpoint = () => getOriginEndpoint('neutron_vpn');
export const lbEndpoint = () => getOriginEndpoint('octavia');

View File

@@ -1,170 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Axios from 'axios';
import { getLocalStorageItem } from 'utils/local-storage';
import { getOpenstackApiVersion } from 'client/client/constants';
import Notify from 'components/Notify';
import { isEqual } from 'lodash';
import baseURL from './base-url';
/**
* @class HttpRequest
* request with axios
*/
class HttpRequest {
constructor() {
// this.CancelToken = Axios.CancelToken;
this.sameRequestInterval = 1000;
this.queue = {};
}
/**
* @param url request url
* delete url from queue
*/
destroy(url) {
delete this.queue[url];
}
/**
* @param instance instance of axios
* @param url request url
* interceptors includes request & response
* @returns {void}
*/
interceptors(instance, url) {
instance.interceptors.request.use(
(config) => {
const keystoneToken = getLocalStorageItem('keystone_token') || '';
const apiVersionMap = getOpenstackApiVersion(url);
if (keystoneToken) {
config.headers['X-Auth-Token'] = keystoneToken;
}
if (apiVersionMap) {
config.headers[apiVersionMap.key] = apiVersionMap.value;
}
return config;
},
(err) => Promise.reject(err)
);
instance.interceptors.response.use(
(response) => {
// request is finished
this.destroy(url);
const { data, status } = response;
const disposition = response.headers['content-disposition'] || '';
const contentType = response.headers['content-type'] || '';
if (contentType.includes('application/octet-stream')) {
return response;
}
if (disposition.includes('attachment')) {
return response;
}
if (status < 200 || status >= 300) {
return Promise.reject(data);
}
return data;
},
(error) => {
// request is finished
this.destroy(url);
if (error.response) {
const { data, status } = error.response;
if ([400, 401, 403, 404].includes(status)) {
const keys = Object.keys(data);
if (keys.length && data[keys[0]]) {
Notify.error(data[keys[0]].message || data[keys[0]].toString());
}
} else if (status === 500) {
Notify.error(t('System is busy, please try again later'));
} else {
Notify.error(t('System error'));
}
}
return Promise.reject(error.toString());
}
);
}
/**
* create a new instance of axios with a custom config
*/
create() {
const conf = {
baseURL,
timeout: 120000,
headers: {
'content-type': 'application/json;charset=utf-8',
'cache-control': 'no-cache',
pragma: 'no-cache',
},
};
return Axios.create(conf);
}
/**
* @param {Object} obj translated object
* @returns {Object} trim undefined & null
*/
omitNil(obj) {
if (typeof obj !== 'object') return obj;
return Object.keys(obj).reduce((acc, v) => {
if (obj[v] !== undefined && obj[v] !== null) acc[v] = obj[v];
return acc;
}, {});
}
/**
* build request
* @param {Object} config requests config
* @returns {Promise} axios instance return promise
*/
request(config) {
const method = config.method ? config.method.toLowerCase() : 'get';
const options = { ...config };
// Only get and head, we need to use null for some posts requests
if (options.params && ['get', 'head'].includes(method)) {
options.params = this.omitNil(options.params);
}
// prevent request repeat quickly
if (method !== 'get') {
const requestInfo = this.queue[options.url];
const now = Date.now();
if (
requestInfo &&
now - requestInfo.timestamp < this.sameRequestInterval &&
isEqual(options, requestInfo.options)
) {
Notify.error(t('Please do not request repeat quickly'));
return Promise.reject(
new Error(t('Please do not request repeat quickly'))
);
}
}
const instance = this.create();
this.interceptors(instance, options.url);
this.queue[options.url] = {
instance,
options,
timestamp: Date.now(),
};
return instance(options);
}
}
export default new HttpRequest();

View File

@@ -1,19 +0,0 @@
// Copyright 2021 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const DEV_URL = '/';
const PRO_URL = '/';
const { API } = process.env;
export default API === 'mock' || API === 'dev' ? DEV_URL : PRO_URL;

View File

@@ -22,6 +22,11 @@ export class LbaasStore extends Base {
return client.octavia.loadbalancers;
}
get fipStore() {
const globalFloatingIpsStore = require('stores/neutron/floatingIp').default;
return globalFloatingIpsStore;
}
get listFilterByProject() {
return true;
}
@@ -58,10 +63,9 @@ export class LbaasStore extends Base {
this.updateMarker(allData, page, result);
const allDataNew = allData.map(this.mapperBeforeFetchProject);
let newData = await this.listDidFetchProject(allDataNew, all_projects);
const globalFloatingIpsStore = require('stores/neutron/floatingIp').default;
const fipDetails = await Promise.all(
newData.map((item) =>
globalFloatingIpsStore.pureFetchList({
this.fipStore.pureFetchList({
port_id: item.vip_port_id,
fixed_ip_address: item.vip_address,
all_projects,
@@ -118,9 +122,7 @@ export class LbaasStore extends Base {
try {
const newItem = await this.detailDidFetch(item, all_projects);
const detail = this.mapper(newItem);
const globalFloatingIpsStore =
require('stores/neutron/floatingIp').default;
const fipInfo = await globalFloatingIpsStore.fetchList({
const fipInfo = await this.fipStore.fetchList({
fixed_ip_address: item.vip_address,
});
fipInfo.length > 0 && (detail.fip = fipInfo[0].floating_ip_address);

View File

@@ -20,9 +20,8 @@ export default class OverviewStore {
this.reset(true);
}
@action
reset = (init) => {
const state = {
get initValue() {
return {
projectInfoLoading: true,
computeServiceLoading: true,
networkServiceLoading: true,
@@ -34,10 +33,13 @@ export default class OverviewStore {
projectNum: 0,
userNum: 0,
nodeNum: 0,
ticketNum: 0,
criticalNum: 0,
},
};
}
@action
reset(init) {
const state = this.initValue;
if (init) {
extendObservable(this, state);
@@ -46,10 +48,10 @@ export default class OverviewStore {
this[key] = state[key];
});
}
};
}
@action
getProjectInfoData = async () => {
async getProjectInfoData() {
this.projectInfoLoading = true;
const promiseArray = [
client.keystone.projects.list(),
@@ -66,10 +68,10 @@ export default class OverviewStore {
this.platformNum.userNum = users.length;
this.platformNum.nodeNum = services.length;
this.projectInfoLoading = false;
};
}
@action
getVirtualResource = async () => {
async getVirtualResource() {
this.virtualResourceLoading = true;
const promiseArray = [
client.skyline.extension.servers({ limit: 10, all_projects: true }),
@@ -143,23 +145,23 @@ export default class OverviewStore {
};
this.virtualResource = { serviceNum, volumeNum };
this.virtualResourceLoading = false;
};
}
@action
getComputeService = async () => {
async getComputeService() {
this.computeServiceLoading = true;
const servicesResult = await client.nova.services.list();
const { services } = servicesResult;
this.computeService = services;
this.computeServiceLoading = false;
};
}
@action
getNetworkService = async () => {
async getNetworkService() {
this.networkServiceLoading = true;
const networkResult = await client.neutron.agents.list();
const { agents } = networkResult;
this.networkService = agents;
this.networkServiceLoading = false;
};
}
}