forked from akka/alpakka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Request builder for delete container 2. Implementation of delete container and Scala and Java API 3. Tests for delete container 4. Documentation
- Loading branch information
Showing
10 changed files
with
195 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...e-storage/src/main/scala/akka/stream/alpakka/azure/storage/requests/DeleteContainer.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) since 2016 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akka.stream.alpakka | ||
package azure | ||
package storage | ||
package requests | ||
|
||
import akka.http.scaladsl.model.{HttpHeader, HttpMethod, HttpMethods} | ||
import akka.stream.alpakka.azure.storage.headers.ServerSideEncryption | ||
import akka.stream.alpakka.azure.storage.impl.StorageHeaders | ||
|
||
final class DeleteContainer(val leaseId: Option[String] = None, | ||
override val sse: Option[ServerSideEncryption] = None, | ||
override val additionalHeaders: Seq[HttpHeader] = Seq.empty) | ||
extends RequestBuilder { | ||
|
||
override protected val method: HttpMethod = HttpMethods.DELETE | ||
|
||
override protected val queryParams: Map[String, String] = super.queryParams ++ Map("restype" -> "container") | ||
|
||
def withLeaseId(leaseId: String): DeleteContainer = copy(leaseId = Option(leaseId)) | ||
|
||
override def withServerSideEncryption(sse: ServerSideEncryption): DeleteContainer = copy(sse = Option(sse)) | ||
|
||
override def addHeader(httpHeader: HttpHeader): DeleteContainer = | ||
copy(additionalHeaders = additionalHeaders :+ httpHeader) | ||
|
||
override protected def getHeaders: Seq[HttpHeader] = | ||
StorageHeaders() | ||
.witServerSideEncryption(sse) | ||
.withLeaseIdHeader(leaseId) | ||
.withAdditionalHeaders(additionalHeaders) | ||
.headers | ||
|
||
private def copy(leaseId: Option[String] = leaseId, | ||
sse: Option[ServerSideEncryption] = sse, | ||
additionalHeaders: Seq[HttpHeader] = additionalHeaders) = | ||
new DeleteContainer(leaseId = leaseId, sse = sse, additionalHeaders = additionalHeaders) | ||
} | ||
|
||
object DeleteContainer { | ||
|
||
/* | ||
* Scala API | ||
*/ | ||
def apply(): DeleteContainer = new DeleteContainer() | ||
|
||
/* | ||
* Java API | ||
*/ | ||
def create(): DeleteContainer = DeleteContainer() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.