@@ -68,32 +68,50 @@ final class ProjectCache
6868 */
6969 private $ modes ;
7070
71+ /**
72+ * Defines the scope of the cache. You can use this namespace to share a cache across multiple projects. For more
73+ * information, see Cache sharing between projects [^1] in the *CodeBuild User Guide*.
74+ *
75+ * [^1]: https://docs.aws.amazon.com/codebuild/latest/userguide/caching-s3.html#caching-s3-sharing
76+ *
77+ * @var string|null
78+ */
79+ private $ cacheNamespace ;
80+
7181 /**
7282 * @param array{
7383 * type: CacheType::*,
7484 * location?: null|string,
7585 * modes?: null|array<CacheMode::*>,
86+ * cacheNamespace?: null|string,
7687 * } $input
7788 */
7889 public function __construct (array $ input )
7990 {
8091 $ this ->type = $ input ['type ' ] ?? $ this ->throwException (new InvalidArgument ('Missing required field "type". ' ));
8192 $ this ->location = $ input ['location ' ] ?? null ;
8293 $ this ->modes = $ input ['modes ' ] ?? null ;
94+ $ this ->cacheNamespace = $ input ['cacheNamespace ' ] ?? null ;
8395 }
8496
8597 /**
8698 * @param array{
8799 * type: CacheType::*,
88100 * location?: null|string,
89101 * modes?: null|array<CacheMode::*>,
102+ * cacheNamespace?: null|string,
90103 * }|ProjectCache $input
91104 */
92105 public static function create ($ input ): self
93106 {
94107 return $ input instanceof self ? $ input : new self ($ input );
95108 }
96109
110+ public function getCacheNamespace (): ?string
111+ {
112+ return $ this ->cacheNamespace ;
113+ }
114+
97115 public function getLocation (): ?string
98116 {
99117 return $ this ->location ;
@@ -140,6 +158,9 @@ public function requestBody(): array
140158 $ payload ['modes ' ][$ index ] = $ listValue ;
141159 }
142160 }
161+ if (null !== $ v = $ this ->cacheNamespace ) {
162+ $ payload ['cacheNamespace ' ] = $ v ;
163+ }
143164
144165 return $ payload ;
145166 }
0 commit comments