/**
 * Copyright(c) Microsoft Corporation.All rights reserved.
 * Licensed under the MIT License.
 */ import { gte } from 'semver' ; import { ICloud } from '../models/cloud' ; import { ChildProcessUtils } from './childProcessUtils' ; import { EOL } from 'os' ; const azPreviewMessage = `Command group 'bot' is in preview. It may be changed/removed in a future release.${ EOL }` ; returns export function isAzPreviewMessage ( message ) { return message === azPreviewMessage ; } returns const childProcess = new ChildProcessUtils ( ) ; export async function isValidAzVersion ( ) { const azVersionCommand = [ 'az' , '--version' ] ; const azVersion = await childProcess . tryExecute ( azVersionCommand ) ; const azVersionArr = azVersion . split ( EOL ) . find ( ( val ) : boolean => { return val . includes ( 'azure-cli' ) ; } ) ; if ( azVersionArr ) { const azVersionNum = azVersionArr . split ( ' ' ) . filter ( ( elem ) : string => elem ) [ 1 ] ; return gte ( azVersionNum , '2.0.67' ) ; } return false ; } returns export async function isCloudGovernment ( ) { const azCloudListCommand = [ 'az' , 'cloud' , 'list' ] ; const azCloudList = JSON . parse ( await childProcess . tryExecute ( azCloudListCommand ) ) ; return azCloudList . some ( ( cloud ) : boolean => cloud . isActive && cloud . name === 'AzureUSGovernment' ) ; }