Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions repository/AWS-CloudWatch-Logs/AWSLogs.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ AWSLogs >> getStream: streamName group: groupName [
]

{ #category : #initialization }
AWSLogs >> initWithCredentials: aCredentials region: aRegion [

super initWithCredentials: aCredentials region: aRegion.
endpoint := 'https://logs.', region asLowercase, '.amazonaws.com'.
AWSLogs >> initEndpointWithRegion: aRegion [
endpoint := 'https://logs.' , region asLowercase , '.amazonaws.com'
]
7 changes: 6 additions & 1 deletion repository/AWS-Core/AWSService.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,15 @@ AWSService >> httpClient [
]

{ #category : #initialization }
AWSService >> initWithCredentials: aCredentials region: aRegion [
AWSService >> initEndpointWithRegion: aRegion [
self subclassResponsibility
]

{ #category : #initialization }
AWSService >> initWithCredentials: aCredentials region: aRegion [
awsCredentials := aCredentials.
region := aRegion.
self initEndpointWithRegion: aRegion
]

{ #category : #accessing }
Expand Down
23 changes: 23 additions & 0 deletions repository/AWS-Core/AWSTFormUrlEncoding.trait.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Trait {
#name : #AWSTFormUrlEncoding,
#category : #'AWS-Core'
}

{ #category : #internal }
AWSTFormUrlEncoding classSide >> convertEntity: aFormUrlEncodedEntity [
"Workaround for issue: https://github.com/svenvc/zinc/issues/50"

| bytes |
bytes := (String
streamContents: [ :s | aFormUrlEncodedEntity writeOn: s ])
utf8Encoded.
^ (ZnByteArrayEntity type: ZnMimeType applicationFormUrlEncoded)
bytes: bytes;
contentLength: bytes size;
yourself
]

{ #category : #internal }
AWSTFormUrlEncoding >> convertEntity: aFormUrlEncodedEntity [
^ self class convertEntity: aFormUrlEncodedEntity
]
18 changes: 18 additions & 0 deletions repository/AWS-Core/AWSTXmlErrorResponseHandler.trait.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Trait {
#name : #AWSTXmlErrorResponseHandler,
#category : #'AWS-Core'
}

{ #category : #internal }
AWSTXmlErrorResponseHandler >> handleErrorResponse: httpResponse [
| dom |
(httpResponse hasEntity and: [ httpResponse contentType sub = 'xml' ])
ifFalse: [ ^ super handleErrorResponse: httpResponse ].
dom := self xmlParser parse: httpResponse contents.
(AWSError xmlData: dom root) signal
]

{ #category : #internal }
AWSTXmlErrorResponseHandler >> xmlParser [
^ XMLDOMParser
]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #AWSXmlObject,
#superclass : #Object,
#category : #'AWS-SimpleStorageService'
#category : #'AWS-Core'
}

{ #category : #'instance creation' }
Expand All @@ -17,3 +17,8 @@ AWSXmlObject class >> fromXmlString: aString [
xmlDoc := XMLDOMParser parse: aString.
^ self fromXmlElement: xmlDoc root
]

{ #category : #initialization }
AWSXmlObject >> initFromXmlElement: xmlElement [
self subclassResponsibility
]
16 changes: 2 additions & 14 deletions repository/AWS-SimpleQueueService/AWSSQSRequest.class.st
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
Class {
#name : #AWSSQSRequest,
#superclass : #Object,
#traits : 'AWSTFormUrlEncoding',
#classTraits : 'AWSTFormUrlEncoding classTrait',
#category : #'AWS-SimpleQueueService'
}

{ #category : #internal }
AWSSQSRequest class >> convertEntity: aFormUrlEncodedEntity [
"Workaround for issue: https://github.com/svenvc/zinc/issues/50"

| bytes |

bytes := (String streamContents: [ :s | aFormUrlEncodedEntity writeOn: s ]) utf8Encoded.

^ (ZnByteArrayEntity type: ZnMimeType applicationFormUrlEncoded)
bytes: bytes;
contentLength: bytes size;
yourself
]

{ #category : #internal }
AWSSQSRequest class >> createEntityForAction: actionName [

Expand Down
26 changes: 4 additions & 22 deletions repository/AWS-SimpleQueueService/AWSSQService.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Class {
#name : #AWSSQService,
#superclass : #AWSService,
#traits : 'AWSTXmlErrorResponseHandler',
#classTraits : 'AWSTXmlErrorResponseHandler classTrait',
#category : #'AWS-SimpleQueueService'
}

Expand Down Expand Up @@ -139,23 +141,9 @@ AWSSQService >> getQueueUrlNamed: qName [
response queueUrl ]
]

{ #category : #internal }
AWSSQService >> handleErrorResponse: httpResponse [

| dom |

(httpResponse hasEntity and: [ httpResponse contentType sub = 'xml' ])
ifFalse: [ ^ super handleErrorResponse: httpResponse ].

dom := self xmlParser parse: httpResponse contents.
(AWSError xmlData: dom root) signal
]

{ #category : #initialization }
AWSSQService >> initWithCredentials: aCredentials region: aRegion [

super initWithCredentials: aCredentials region: aRegion.
endpoint := 'https://sqs.', region asLowercase, '.amazonaws.com'.
AWSSQService >> initEndpointWithRegion: aRegion [
endpoint := 'https://sqs.' , region asLowercase , '.amazonaws.com'
]

{ #category : #api }
Expand Down Expand Up @@ -250,9 +238,3 @@ AWSSQService >> sendMessage: aSendMessageRequest on: aQueueUrl [

^ response
]

{ #category : #resources }
AWSSQService >> xmlParser [

^ XMLDOMParser
]
20 changes: 2 additions & 18 deletions repository/AWS-SimpleStorageService/AWSS3Service.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Class {
#name : #AWSS3Service,
#superclass : #AWSService,
#traits : 'AWSTXmlErrorResponseHandler',
#classTraits : 'AWSTXmlErrorResponseHandler classTrait',
#category : #'AWS-SimpleStorageService'
}

Expand All @@ -20,18 +22,6 @@ AWSS3Service >> executeRequest: httpRequest [
^ response
]

{ #category : #internal }
AWSS3Service >> handleErrorResponse: httpResponse [

| dom |

((ZnMimeType applicationXml matches: httpResponse contentType) and: [ httpResponse hasEntity ])
ifFalse: [ ^ super handleErrorResponse: httpResponse ].

dom := self xmlParser parse: httpResponse contents.
(AWSError xmlData: dom root) signal
]

{ #category : #internal }
AWSS3Service >> signRequest: httpRequest [

Expand All @@ -53,9 +43,3 @@ AWSS3Service >> signRequest: httpRequest [

AWSSignerV4 new sign: httpRequest using: awsCredentials with: params
]

{ #category : #resources }
AWSS3Service >> xmlParser [

^ XMLDOMParser
]
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ AWSSimpleStorageService >> head: bucketName [
]

{ #category : #initialization }
AWSSimpleStorageService >> initWithCredentials: aCredentials region: aRegion [

super initWithCredentials: aCredentials region: aRegion.
endpoint := 'https://s3-', region asLowercase, '.amazonaws.com'.
AWSSimpleStorageService >> initEndpointWithRegion: aRegion [
endpoint := 'https://s3-' , region asLowercase , '.amazonaws.com'
]

{ #category : #operations }
Expand Down