@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreatePipelineRequest == false) return false; CreatePipelineRequest other = (CreatePipelineRequest) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getInputBucket() == null ^ this.getInputBucket() == null) return false; if (other.getInputBucket() != null && other.getInputBucket().equals(this.getInputBucket()) == false) return false; if (other.getOutputBucket() == null ^ this.getOutputBucket() == null) return false; if (other.getOutputBucket() != null && other.getOutputBucket().equals(this.getOutputBucket()) == false) return false; if (other.getRole() == null ^ this.getRole() == null) return false; if (other.getRole() != null && other.getRole().equals(this.getRole()) == false) return false; if (other.getNotifications() == null ^ this.getNotifications() == null) return false; if (other.getNotifications() != null && other.getNotifications().equals(this.getNotifications()) == false) return false; return true; }
public cfData execute(cfSession _session, cfArgStructData argStruct) throws cfmRunTimeException { AmazonKey amazonKey = getAmazonKey(_session, argStruct); AmazonElasticTranscoder et = getAmazonElasticTranscoder(amazonKey); CreatePipelineRequest cpr = new CreatePipelineRequest(); cpr.setName(getNamedStringParam(argStruct, "name", null)); if (cpr.getName() == null || cpr.getName().isEmpty() || cpr.getName().length() > 40) throwException(_session, "please provide a valid name (40chars or less)"); cpr.setInputBucket(getNamedStringParam(argStruct, "inputbucket", null)); if (cpr.getInputBucket() == null || cpr.getInputBucket().isEmpty()) throwException(_session, "please provide a valid inputbucket"); cpr.setRole(getNamedStringParam(argStruct, "role", null)); if (cpr.getRole() == null || cpr.getRole().isEmpty()) throwException(_session, "please provide a valid role"); cpr.setAwsKmsKeyArn(getNamedStringParam(argStruct, "awskey", null)); if (cpr.getAwsKmsKeyArn() == null || cpr.getAwsKmsKeyArn().isEmpty()) throwException(_session, "please provide a valid awskey"); if (getNamedStringParam(argStruct, "outputbucket", null) != null) { cpr.setOutputBucket(getNamedStringParam(argStruct, "outputbucket", null)); if (cpr.getOutputBucket().isEmpty()) throwException(_session, "please provide a 'contentconfig' or a 'outputbucket'"); } else { // Handle the ContentConfig cfStructData cc = getNamedStructParam(_session, argStruct, "contentconfig", null); if (cc == null) throwException(_session, "please provide a 'contentconfig' or a 'outputbucket'"); PipelineOutputConfig contentConfig = new PipelineOutputConfig(); contentConfig.setBucket(cc.getData("bucket").getString()); if (contentConfig.getBucket() == null || contentConfig.getBucket().isEmpty()) throwException(_session, "please provide a 'contentconfig.bucket'"); contentConfig.setStorageClass(cc.getData("storageclass").getString()); if (contentConfig.getStorageClass() == null || contentConfig.getStorageClass().isEmpty()) throwException(_session, "please provide a 'contentconfig.storageclass'"); Collection<Permission> permissions = getPermissions(_session, cc); if (!permissions.isEmpty()) contentConfig.setPermissions(permissions); cpr.setContentConfig(contentConfig); // Handle the thumbnailconfig cc = getNamedStructParam(_session, argStruct, "thumbnailconfig", null); if (cc == null) throwException(_session, "please provide a 'thumbnailconfig' or a 'outputbucket'"); contentConfig = new PipelineOutputConfig(); contentConfig.setBucket(cc.getData("bucket").getString()); if (contentConfig.getBucket() == null || contentConfig.getBucket().isEmpty()) throwException(_session, "please provide a 'thumbnailconfig.bucket'"); contentConfig.setStorageClass(cc.getData("storageclass").getString()); if (contentConfig.getStorageClass() == null || contentConfig.getStorageClass().isEmpty()) throwException(_session, "please provide a 'thumbnailconfig.storageclass'"); permissions = getPermissions(_session, cc); if (!permissions.isEmpty()) contentConfig.setPermissions(permissions); cpr.setThumbnailConfig(contentConfig); } // Now after collection all that; create the actual pipeline try { CreatePipelineResult cpres = et.createPipeline(cpr); return new cfStringData(cpres.getPipeline().getId()); } catch (Exception e) { throwException(_session, "AmazonElasticTranscoder: " + e.getMessage()); return cfBooleanData.TRUE; } }