src/BaiduBce/Services/Media/MediaClient.php
public function createPipeline(
        $pipelineName,
        $sourceBucket,
        $targetBucket,
        $options = array()
    ) {
        list($config, $description, $pipelineConfig) = $this->parseOptions(
            $options,
            'config',
            'description',
            'pipelineConfig'
        );

        if (empty($pipelineName)) {
            throw new BceClientException("The parameter pipelineName " 
                ."should NOT be null or empty string");
        }

        if (empty($sourceBucket)) {
            throw new BceClientException("The parameter sourceBucket " 
                ."should NOT be null or empty string");
        }

        if (empty($targetBucket)) {
            throw new BceClientException("The parameter targetBucket " 
                ."should NOT be null or empty string");
        }

        $body = array(
            'pipelineName' => $pipelineName,
            'sourceBucket' => $sourceBucket,
            'targetBucket' => $targetBucket,
        );
        if ($description !== null) {
            $body['description'] = $description;
        } else {
            $body['description'] = '';
        }
        if ($pipelineConfig !== null) {
            $body['config'] = $pipelineConfig;
        } else {
            $body['config'] = array('capacity' => 20);
        }

        return $this->sendRequest(
            HttpMethod::POST,
            array(
                'config' => $config,
                'body' => json_encode($body),
            ),
            '/pipeline'
        );
    }
public function createPipeline(
        $pipelineName,
        $sourceBucket,
        $targetBucket,
        $options = array()
    ) {
        list($config, $description, $pipelineConfig) = $this->parseOptions(
            $options,
            'config',
            'description',
            'pipelineConfig'
        );

        if (empty($pipelineName)) {
            throw new BceClientException("The parameter pipelineName " 
                ."should NOT be null or empty string");
        }

        if (empty($sourceBucket)) {
            throw new BceClientException("The parameter sourceBucket " 
                ."should NOT be null or empty string");
        }

        if (empty($targetBucket)) {
            throw new BceClientException("The parameter targetBucket " 
                ."should NOT be null or empty string");
        }

        $body = array(
            'pipelineName' => $pipelineName,
            'sourceBucket' => $sourceBucket,
            'targetBucket' => $targetBucket,
        );
        if ($description !== null) {
            $body['description'] = $description;
        } else {
            $body['description'] = '';
        }
        if ($pipelineConfig !== null) {
            $body['config'] = $pipelineConfig;
        } else {
            $body['config'] = array('capacity' => 20);
        }

        return $this->sendRequest(
            HttpMethod::POST,
            array(
                'config' => $config,
                'body' => json_encode($body),
            ),
            '/pipeline'
        );
    }
public function createPipeline ( $ pipelineName , $ sourceBucket , $ targetBucket , $ options = array ( ) ) { list ( $ config , $ description , $ pipelineConfig ) = $ this -> parseOptions ( $ options , 'config' , 'description' , 'pipelineConfig' ) ; if ( empty ( $ pipelineName ) ) { throw new BceClientException ( "The parameter pipelineName " . "should NOT be null or empty string" ) ; } if ( empty ( $ sourceBucket ) ) { throw new BceClientException ( "The parameter sourceBucket " . "should NOT be null or empty string" ) ; } if ( empty ( $ targetBucket ) ) { throw new BceClientException ( "The parameter targetBucket " . "should NOT be null or empty string" ) ; } $ body = array ( 'pipelineName' => $ pipelineName , 'sourceBucket' => $ sourceBucket , 'targetBucket' => $ targetBucket , ) ; if ( $ description !== null ) { $ body [ 'description' ] = $ description ; } else { $ body [ 'description' ] = '' ; } if ( $ pipelineConfig !== null ) { $ body [ 'config' ] = $ pipelineConfig ; } else { $ body [ 'config' ] = array ( 'capacity' => 20 ) ; } return $ this -> sendRequest ( HttpMethod :: POST , array ( 'config' => $ config , 'body' => json_encode ( $ body ) , ) , '/pipeline' ) ; }
Create a pipeline

@param string $pipelineName The pipeline name
@param string $sourceBucket The input source bucket's name in BOS
@param string $targetBucket The output target bucket's name in BOS
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
pipelineConfig: {
capacity: The capacity of pipeline
}
description: The description of pipeline
}
@return mixed
@throws BceClientException
Create a pipeline