You need to sign in to do that
Don't have an account?
Tanya Shah
Compile Error : invalid type
I got this error while getting the list of buckets in Amazon S3 . I know there is already a toolkit available but just wanted to make this simple . Getting an error Error: Compile Error: Invalid type: S3.AmazonS3 at line 12 column 12 .
I'm really stucked here . Please help.
Apex class
VF page
Thank you !
I'm really stucked here . Please help.
Apex class
public class testAWS_S3_Controller { public String getAllBuckets() { return null; } public testAWS_S3_Controller() {} private String AWSCredentialName = 'Demo_S3_account'; //Modify this string variable to be the name of the AWS Credential record that contains the proper AWS keys and secret public String OwnerId {get;set;} public String S3Key {get;set;} public S3.AmazonS3 as3 {get; private set;} //This object represents an instance of the Amazon S3 toolkit and makes all the Web Service calls to AWS. public S3.ListBucketResult listbucket {get;set;} public S3.ListBucketResult ListAllMyBuckets {get;set;} public class AmazonS3 { public AmazonS3(String key, String secret){ this.key = key; this.secret= secret; } public AmazonS3(){ } //Method to return a string array for all the buckets in your AWS S3 account public String[] allBuckets { get { try { Datetime now = Datetime.now(); //This performs the Web Service call to Amazon S3 and retrieves all the Buckets in your AWS Account. S3.ListAllMyBucketsResult allBuckets = as3.ListAllMyBuckets(as3.key, now, as3.signature('ListAllMyBuckets', now)); System.debug(allBuckets); //Store the Canonical User Id for your account OwnerId = allBuckets.Owner.Id; S3.ListAllMyBucketsList bucketList = allBuckets.Buckets; S3.ListAllMyBucketsEntry[] buckets = bucketList.Bucket; allBucketList = buckets; String[] bucketNames = new String[] {}; //Loop through each bucket entry to get the bucket name and store in string array. for (S3.ListAllMyBucketsEntry bucket: buckets) { System.debug('Found bucket with name: ' + bucket.Name); bucketNames.add(bucket.name); } return bucketNames; } catch (System.NullPointerException e) { return null; } catch (Exception ex) { //System.debug(ex); System.debug('caught exception in listallmybuckets'); ApexPages.addMessages(ex); return null; } } //end getter set; } } }
VF page
<apex:page controller="testAWS_S3_Controller"> <apex:outputPanel id="fullRefreshPageId"> <apex:form > <br/> <apex:pageBlock title="Force.com for Amazon Web Services"> <apex:pageMessages /> <!-- THIS PAGE BLOCK SECTION ILLUSTRATES HOW TO LIST ALL BUCKETS IN YOUR S3 ACCOUNT --> <apex:pageBlockSection columns="1" title="List all Buckets in my S3 Account"> <apex:outputText value="Here is the list of buckets available in your S3 account." /> <apex:outputText value="This list is generated by the ListAllMyBuckets web service" /> <apex:dataList value="{!allBuckets}" var="bucket" id="theList"> <apex:outputText value="{!bucket}"/> </apex:dataList> </apex:pageBlockSection> </apex:pageblock> </apex:form> </apex:outputPanel> </apex:page>
Thank you !
public S3.AmazonS3 as3 {get; private set;}
Is there a class which defines this type you have used: S3.AmazonS3