Skip to content

Commit

Permalink
Merge pull request #918 from yaacov/update-types-2.6
Browse files Browse the repository at this point in the history
🤖 Update generated types
  • Loading branch information
yaacov authored Feb 14, 2024
2 parents a4f4d14 + ac93360 commit 23e9e57
Show file tree
Hide file tree
Showing 1,094 changed files with 198,193 additions and 5,317 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React, { useState } from 'react';
import { useForkliftTranslation } from 'src/utils/i18n';

import { MigrationModelGroupVersionKind, V1beta1Migration } from '@kubev2v/types';
import { V1beta1MigrationStatusVms } from '@kubev2v/types/dist/models/V1beta1MigrationStatusVms';
import {
MigrationModelGroupVersionKind,
V1beta1Migration,
V1beta1MigrationStatusVms,
} from '@kubev2v/types';
import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';
import { Chart, ChartAxis, ChartBar, ChartGroup, ChartTooltip } from '@patternfly/react-charts';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';

import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';
import { useK8sWatchResource, WatchK8sResource } from '@openshift-console/dynamic-plugin-sdk';

/**
Expand All @@ -19,7 +19,7 @@ export const useK8sWatchSecretData = (resourceParams: WatchK8sResource): K8sSecr
const [secretLoaded, setLoaded] = useState(false);
const [secretLoadError, setLoadError] = useState<Error | null>(null);

const [secret, loaded, error] = useK8sWatchResource<V1Secret>(resourceParams);
const [secret, loaded, error] = useK8sWatchResource<IoK8sApiCoreV1Secret>(resourceParams);

useEffect(() => {
if (loaded && error) {
Expand All @@ -34,7 +34,7 @@ export const useK8sWatchSecretData = (resourceParams: WatchK8sResource): K8sSecr
setLoaded(true);
};

const handleLoadedSecret = (secret: V1Secret | null) => {
const handleLoadedSecret = (secret: IoK8sApiCoreV1Secret | null) => {
setLoaded(true);
if (JSON.stringify(secret?.data) !== JSON.stringify(secretData)) {
setSecretData(secret?.data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
OpenstackVolumeType,
OVirtStorageDomain,
ProviderType,
TypedOvaResource,
V1beta1Provider,
VSphereDataStore,
} from '@kubev2v/types';
import { TypedOvaResource } from '@kubev2v/types/dist/types/provider/ova/TypedResource';

import useProviderInventory from './useProviderInventory';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Base64 } from 'js-base64';

import { SecretModel, V1beta1Provider, V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret, SecretModel, V1beta1Provider } from '@kubev2v/types';
import { k8sPatch } from '@openshift-console/dynamic-plugin-sdk';

import { OnConfirmHookType } from '../../EditModal';
Expand All @@ -20,7 +20,7 @@ export const patchProviderURL: OnConfirmHookType = async ({ resource, model, new
const providerOp = provider?.spec?.url ? 'replace' : 'add';

// Get providers secret stub
const secret: V1Secret = {
const secret: IoK8sApiCoreV1Secret = {
kind: 'Secret',
apiVersion: 'v1',
metadata: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';

/**
* Compares the data records between two versions of a secret.
*
* @param {V1Secret} secret1 - The first version of the secret.
* @param {V1Secret} secret2 - The second version of the secret.
* @param {IoK8sApiCoreV1Secret} secret1 - The first version of the secret.
* @param {IoK8sApiCoreV1Secret} secret2 - The second version of the secret.
* @returns {boolean} Returns true if the data records have changed, otherwise returns false.
*/
export function isSecretDataChanged(secret1: V1Secret, secret2: V1Secret): boolean {
export function isSecretDataChanged(
secret1: IoK8sApiCoreV1Secret,
secret2: IoK8sApiCoreV1Secret,
): boolean {
// Both secrets don't have data records
if (!secret1.data && !secret2.data) {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Base64 } from 'js-base64';

import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';

/**
* Checks if a list of keys exist in a secret's data, and verifies they are not null or empty strings.
*
* @param {V1Secret} secret - The secret to be checked.
* @param {IoK8sApiCoreV1Secret} secret - The secret to be checked.
* @param {string[]} keys - The list of keys to check.
* @returns {string[]} Returns a list of missing keys in secret data.
*/
export function missingKeysInSecretData(secret: V1Secret, keys: string[]): string[] {
export function missingKeysInSecretData(secret: IoK8sApiCoreV1Secret, keys: string[]): string[] {
// If secret or secret's data is not defined, return false
if (!secret?.data) {
return keys;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Base64 } from 'js-base64';

import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';

import { ValidationMsg } from '../../common';

import { openshiftSecretFieldValidator } from './openshiftSecretFieldValidator';

export function openshiftSecretValidator(secret: V1Secret): ValidationMsg {
export function openshiftSecretValidator(secret: IoK8sApiCoreV1Secret): ValidationMsg {
const url = secret?.data?.url || '';
const token = secret?.data?.token || '';
const cacert = secret?.data?.cacert || '';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';

import { missingKeysInSecretData, safeBase64Decode } from '../../../helpers';
import { ValidationMsg } from '../../common';

import { openstackSecretFieldValidator } from './openstackSecretFieldValidator';

export function openstackSecretValidator(secret: V1Secret): ValidationMsg {
export function openstackSecretValidator(secret: IoK8sApiCoreV1Secret): ValidationMsg {
const authType = safeBase64Decode(secret?.data?.['authType']) || 'password';

let requiredFields = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Base64 } from 'js-base64';

import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';

import { missingKeysInSecretData } from '../../../helpers';
import { ValidationMsg } from '../../common';

import { ovirtSecretFieldValidator } from './ovirtSecretFieldValidator';

export function ovirtSecretValidator(secret: V1Secret): ValidationMsg {
export function ovirtSecretValidator(secret: IoK8sApiCoreV1Secret): ValidationMsg {
const requiredFields = ['user', 'password'];
const validateFields = ['user', 'password', 'insecureSkipVerify', 'cacert'];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { V1beta1Provider, V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret, V1beta1Provider } from '@kubev2v/types';

import { ValidationMsg } from '../common';

Expand All @@ -7,7 +7,7 @@ import { secretValidator } from './secretValidator';

export function providerAndSecretValidator(
provider: V1beta1Provider,
secret: V1Secret,
secret: IoK8sApiCoreV1Secret,
): ValidationMsg {
const providerValidation = providerValidator(provider);
if (providerValidation) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';

import { ValidationMsg } from '../common';

Expand All @@ -7,7 +7,7 @@ import { openstackSecretValidator } from './openstack/openstackSecretValidator';
import { ovirtSecretValidator } from './ovirt/ovirtSecretValidator';
import { vsphereSecretValidator } from './vsphere/vsphereSecretValidator';

export function secretValidator(type: string, secret: V1Secret): ValidationMsg {
export function secretValidator(type: string, secret: IoK8sApiCoreV1Secret): ValidationMsg {
let validationError: ValidationMsg;

switch (type) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Base64 } from 'js-base64';

import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';

import { missingKeysInSecretData } from '../../../helpers';
import { ValidationMsg } from '../../common';

import { vsphereSecretFieldValidator } from './vsphereSecretFieldValidator';

export function vsphereSecretValidator(secret: V1Secret): ValidationMsg {
export function vsphereSecretValidator(secret: IoK8sApiCoreV1Secret): ValidationMsg {
const requiredFields = ['user', 'password'];
const validateFields = ['user', 'password', 'insecureSkipVerify', 'cacert'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Base64 } from 'js-base64';
import SectionHeading from 'src/components/headers/SectionHeading';
import { ForkliftTrans, useForkliftTranslation } from 'src/utils/i18n';

import { ProviderModelRef, V1beta1Provider, V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret, ProviderModelRef, V1beta1Provider } from '@kubev2v/types';
import {
Alert,
Button,
Expand All @@ -27,7 +27,7 @@ import { createProvider, createProviderSecret, patchProviderSecretOwner } from '
import './ProvidersCreatePage.style.css';

interface ProvidersCreatePageState {
newSecret: V1Secret;
newSecret: IoK8sApiCoreV1Secret;
newProvider: V1beta1Provider;
validationError: ValidationMsg;
apiError: Error | null;
Expand Down Expand Up @@ -65,7 +65,7 @@ export const ProvidersCreatePage: React.FC<{

function reducer(
state: ProvidersCreatePageState,
action: { type: string; payload?: string | V1Secret | V1beta1Provider },
action: { type: string; payload?: string | IoK8sApiCoreV1Secret | V1beta1Provider },
): ProvidersCreatePageState {
switch (action.type) {
case 'SET_NEW_SECRET': {
Expand Down Expand Up @@ -134,7 +134,7 @@ export const ProvidersCreatePage: React.FC<{
}

// Handle user edits
function onNewSecretChange(newValue: V1Secret) {
function onNewSecretChange(newValue: IoK8sApiCoreV1Secret) {
// update staged secret with new value
dispatch({ type: 'SET_NEW_SECRET', payload: newValue });
}
Expand All @@ -147,7 +147,7 @@ export const ProvidersCreatePage: React.FC<{

// Handle user clicking "save"
async function onUpdate() {
let secret: V1Secret;
let secret: IoK8sApiCoreV1Secret;
let provider: V1beta1Provider;

toggleIsLoading();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { SelectableCard } from 'src/modules/Providers/utils/components/Galerry/S
import { SelectableGallery } from 'src/modules/Providers/utils/components/Galerry/SelectableGallery';
import { useForkliftTranslation } from 'src/utils/i18n';

import { ProviderType, V1beta1Provider, V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret, ProviderType, V1beta1Provider } from '@kubev2v/types';
import { Flex, FlexItem, Form, FormGroup, TextInput } from '@patternfly/react-core';

import { EditProvider } from './EditProvider';
import { EditProviderSectionHeading } from './EditProviderSectionHeading';
import { providerCardItems } from './providerCardItems';
export interface ProvidersCreateFormProps {
newProvider: V1beta1Provider;
newSecret: V1Secret;
newSecret: IoK8sApiCoreV1Secret;
onNewProviderChange: (V1beta1Provider) => void;
onNewSecretChange: (V1Secret) => void;
onNewSecretChange: (IoK8sApiCoreV1Secret) => void;
providerNames?: string[];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';

export const secretTemplate: V1Secret = {
export const secretTemplate: IoK8sApiCoreV1Secret = {
kind: 'Secret',
apiVersion: 'v1',
metadata: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ProviderModel, V1beta1Provider, V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret, ProviderModel, V1beta1Provider } from '@kubev2v/types';
import { k8sCreate } from '@openshift-console/dynamic-plugin-sdk';

/**
* Creates a new provider with the specified secret information.
*
* @param {V1beta1Provider} provider - The provider object to be cloned and modified.
* @param {V1Secret} secret - The secret object used to update the provider's secret information.
* @param {IoK8sApiCoreV1Secret} secret - The secret object used to update the provider's secret information.
* @returns {Promise<Object>} A Promise that resolves to the created provider object.
*
* @async
Expand All @@ -20,7 +20,7 @@ import { k8sCreate } from '@openshift-console/dynamic-plugin-sdk';
* .then(newProvider => console.log(newProvider))
* .catch(err => console.error(err));
*/
export async function createProvider(provider: V1beta1Provider, secret: V1Secret) {
export async function createProvider(provider: V1beta1Provider, secret: IoK8sApiCoreV1Secret) {
// Sanity check, don't try to create empty provider
if (!provider) {
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Base64 } from 'js-base64';

import { SecretModel, V1beta1Provider, V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret, SecretModel, V1beta1Provider } from '@kubev2v/types';
import { k8sCreate } from '@openshift-console/dynamic-plugin-sdk';

/**
* Creates a new Kubernetes secret using the provided provider and secret data.
*
* @param {V1beta1Provider} provider - The provider object which includes metadata and spec information.
* @param {V1Secret} secret - The base secret object to be cloned and modified.
* @param {IoK8sApiCoreV1Secret} secret - The base secret object to be cloned and modified.
* @returns {Promise<Object>} A Promise that resolves to the created Kubernetes secret object.
*
* @async
Expand All @@ -22,7 +22,10 @@ import { k8sCreate } from '@openshift-console/dynamic-plugin-sdk';
* .then(newSecret => console.log(newSecret))
* .catch(err => console.error(err));
*/
export async function createProviderSecret(provider: V1beta1Provider, secret: V1Secret) {
export async function createProviderSecret(
provider: V1beta1Provider,
secret: IoK8sApiCoreV1Secret,
) {
const url = provider?.spec?.url;

// Sanity check, don't try to create empty secret, or a secret without url
Expand All @@ -34,7 +37,7 @@ export async function createProviderSecret(provider: V1beta1Provider, secret: V1
const generateName = `${provider.metadata.name}-`;
const cleanedData = cleanObject(secret?.data);

const newSecret: V1Secret = {
const newSecret: IoK8sApiCoreV1Secret = {
...secret,
metadata: {
...secret?.metadata,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { SecretModel, V1beta1Provider, V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret, SecretModel, V1beta1Provider } from '@kubev2v/types';
import { k8sPatch } from '@openshift-console/dynamic-plugin-sdk';

/**
* Updates the owner reference of the specified secret to point to the provided provider.
*
* @param {V1beta1Provider} provider - The provider object to be set as the owner of the secret.
* @param {V1Secret} secret - The secret object to be updated with the provider's owner reference.
* @param {IoK8sApiCoreV1Secret} secret - The secret object to be updated with the provider's owner reference.
*
* @async
* @throws Will throw an error if the k8sPatch operation fails.
Expand All @@ -19,7 +19,10 @@ import { k8sPatch } from '@openshift-console/dynamic-plugin-sdk';
* .then(() => console.log('Secret owner patched successfully'))
* .catch(err => console.error(err));
*/
export async function patchProviderSecretOwner(provider: V1beta1Provider, secret: V1Secret) {
export async function patchProviderSecretOwner(
provider: V1beta1Provider,
secret: IoK8sApiCoreV1Secret,
) {
// Sanity check, don't try to patch empty secret
if (!secret) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { ProviderData } from 'src/modules/Providers/utils';
import { useForkliftTranslation } from 'src/utils/i18n';

import { V1Secret } from '@kubev2v/types';
import { IoK8sApiCoreV1Secret } from '@kubev2v/types';
import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';

import { OpenshiftCredentialsSection } from './OpenshiftCredentialsSection';
Expand Down Expand Up @@ -55,7 +55,7 @@ export const CredentialsSection_: React.FC<{ name: string; namespace: string; ty
}) => {
const { t } = useForkliftTranslation();

const [secret, loaded, loadError] = useK8sWatchResource<V1Secret>({
const [secret, loaded, loadError] = useK8sWatchResource<IoK8sApiCoreV1Secret>({
groupVersionKind: { version: 'v1', kind: 'Secret' },
namespaced: true,
namespace: namespace,
Expand Down
Loading

0 comments on commit 23e9e57

Please sign in to comment.