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.
Create & Delete directory support akka#3253
1. Request builder for create & delete directories 2. Implementation of create & delete directories and Scala and Java API 3. Tests for create & delete directories 4. Documentation
- Loading branch information
Showing
11 changed files
with
391 additions
and
25 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
48 changes: 48 additions & 0 deletions
48
...e-storage/src/main/scala/akka/stream/alpakka/azure/storage/requests/CreateDirectory.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,48 @@ | ||
/* | ||
* 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 CreateDirectory(override val sse: Option[ServerSideEncryption] = None, | ||
override val additionalHeaders: Seq[HttpHeader] = Seq.empty) | ||
extends RequestBuilder { | ||
|
||
override protected val method: HttpMethod = HttpMethods.PUT | ||
|
||
override protected val queryParams: Map[String, String] = super.queryParams ++ Map("restype" -> "directory") | ||
|
||
override def withServerSideEncryption(sse: ServerSideEncryption): CreateDirectory = copy(sse = Option(sse)) | ||
|
||
override def addHeader(httpHeader: HttpHeader): CreateDirectory = | ||
copy(additionalHeaders = additionalHeaders :+ httpHeader) | ||
|
||
private def copy(sse: Option[ServerSideEncryption] = sse, additionalHeaders: Seq[HttpHeader] = additionalHeaders) = | ||
new CreateDirectory(sse = sse, additionalHeaders = additionalHeaders) | ||
|
||
override protected def getHeaders: Seq[HttpHeader] = | ||
StorageHeaders() | ||
.witServerSideEncryption(sse) | ||
.withAdditionalHeaders(additionalHeaders) | ||
.headers | ||
} | ||
|
||
object CreateDirectory { | ||
|
||
/* | ||
* Scala API | ||
*/ | ||
def apply(): CreateDirectory = new CreateDirectory() | ||
|
||
/* | ||
* Java API | ||
*/ | ||
def create(): CreateDirectory = CreateDirectory() | ||
} |
48 changes: 48 additions & 0 deletions
48
...e-storage/src/main/scala/akka/stream/alpakka/azure/storage/requests/DeleteDirectory.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,48 @@ | ||
/* | ||
* 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 DeleteDirectory(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" -> "directory") | ||
|
||
override def withServerSideEncryption(sse: ServerSideEncryption): DeleteDirectory = copy(sse = Option(sse)) | ||
|
||
override def addHeader(httpHeader: HttpHeader): DeleteDirectory = | ||
copy(additionalHeaders = additionalHeaders :+ httpHeader) | ||
|
||
private def copy(sse: Option[ServerSideEncryption] = sse, additionalHeaders: Seq[HttpHeader] = additionalHeaders) = | ||
new DeleteDirectory(sse = sse, additionalHeaders = additionalHeaders) | ||
|
||
override protected def getHeaders: Seq[HttpHeader] = | ||
StorageHeaders() | ||
.witServerSideEncryption(sse) | ||
.withAdditionalHeaders(additionalHeaders) | ||
.headers | ||
} | ||
|
||
object DeleteDirectory { | ||
|
||
/* | ||
* Scala API | ||
*/ | ||
def apply(): DeleteDirectory = new DeleteDirectory() | ||
|
||
/* | ||
* Java API | ||
*/ | ||
def create(): DeleteDirectory = DeleteDirectory() | ||
} |
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.