-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from pbcccBeatBoard/main
pull request test from pbcccBeatBoard
- Loading branch information
Showing
41 changed files
with
1,997 additions
and
17 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
18 changes: 18 additions & 0 deletions
18
src/main/java/kr/co/mcmp/config/oss/RestTemplateConfig.java
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,18 @@ | ||
package kr.co.mcmp.config.oss; | ||
|
||
import org.apache.http.impl.client.HttpClientBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@Configuration | ||
public class RestTemplateConfig { | ||
|
||
@Bean(name = "customRestTemplate") | ||
public RestTemplate restTemplate() { | ||
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); | ||
factory.setHttpClient(HttpClientBuilder.create().setMaxConnTotal(50).setMaxConnPerRoute(50).build()); | ||
return new RestTemplate(factory); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/kr/co/mcmp/config/oss/RestTemplateProvider.java
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,22 @@ | ||
package kr.co.mcmp.config.oss; | ||
|
||
import org.springframework.beans.BeansException; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ApplicationContextAware; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@Component | ||
public class RestTemplateProvider implements ApplicationContextAware { | ||
|
||
private static ApplicationContext applicationContext; | ||
|
||
@Override | ||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
this.applicationContext = applicationContext; | ||
} | ||
|
||
public static RestTemplate get() { | ||
return applicationContext.getBean("customRestTemplate", RestTemplate.class); | ||
} | ||
} |
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,20 @@ | ||
package kr.co.mcmp.dto.oss; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class NexusFormatType { | ||
|
||
@Schema(title = "레포지토리 포맷 유형") | ||
private String format; | ||
|
||
@Schema(title = "레포지토리 타입 유형") | ||
private String type; | ||
} |
193 changes: 193 additions & 0 deletions
193
src/main/java/kr/co/mcmp/dto/oss/NexusRepositoryDto.java
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,193 @@ | ||
package kr.co.mcmp.dto.oss; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
|
||
@Getter | ||
public class NexusRepositoryDto { | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class ResGetRepositoryDto { | ||
@Schema(title = "레포지토리 이름", required = true) | ||
@NotBlank | ||
private String name; | ||
|
||
@Schema(title = "레포지토리 포맷 유형", required = true) | ||
@NotBlank | ||
private String format; | ||
|
||
@Schema(title = "레포지토리 타입 유형", required = true) | ||
@NotBlank | ||
private String type; | ||
|
||
@Schema(title = "레포지토리 접근 url", required = true) | ||
@NotBlank | ||
private String url; | ||
|
||
@Schema(title = "레포지토리 사용자 접근 가능 여부", required = true) | ||
@NotNull | ||
private Boolean online; | ||
|
||
@Valid | ||
private ResGetStorageDto storage; | ||
|
||
@Valid | ||
private ResGetDockerDto docker; | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class ResGetStorageDto { | ||
@Schema(title = "아티팩트를 저장하는 물리적 저장소 이름", required = true, example = "default") | ||
@NotBlank | ||
private String blobStoreName; | ||
|
||
@Schema(title = "저장되는 아티팩트 유형 일치 여부 검증", required = true) | ||
@NotNull | ||
private Boolean strictContentTypeValidation; | ||
|
||
@Schema(title = "레포지토리 읽기/쓰기 설정", required = true, example = "allow, allow_once, read_only") | ||
@NotBlank | ||
private String writePolicy; | ||
} | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class ResGetDockerDto { | ||
@Schema(title = "도커 registry 버전 지원(false: v2 지원)", required = true) | ||
@NotNull | ||
private Boolean v1Enabled; | ||
|
||
@Schema(title = "도커 클라이언트가 레포지토리에 접근할 때 기본 인증 사용 여부", required = true) | ||
@NotNull | ||
private Boolean forceBasicAuth; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 http 포트") | ||
private Integer httpPort; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 https 포트") | ||
private Integer httpsPort; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 서브도메인") | ||
private String subdomain; | ||
} | ||
} | ||
|
||
@Getter | ||
public static class ReqCreateRepositoryDto { | ||
@Schema(title = "레포지토리 이름", required = true) | ||
@NotBlank | ||
private String name; | ||
|
||
@Schema(title = "레포지토리 사용자 접근 가능 여부", required = true) | ||
@NotNull | ||
private Boolean online; | ||
|
||
@Valid | ||
private ReqCreateStorageDto storage; | ||
|
||
@Valid | ||
private ReqCreateDockerDto docker; | ||
|
||
@Getter | ||
public static class ReqCreateStorageDto { | ||
@Schema(title = "아티팩트를 저장하는 물리적 저장소 이름", required = true, example = "default") | ||
@NotBlank | ||
private String blobStoreName; | ||
|
||
@Schema(title = "저장되는 아티팩트 유형 일치 여부 검증", required = true) | ||
@NotNull | ||
private Boolean strictContentTypeValidation; | ||
|
||
@Schema(title = "레포지토리 읽기/쓰기 설정", required = true, example = "allow, allow_once, read_only") | ||
@NotBlank | ||
private String writePolicy; | ||
} | ||
|
||
@Getter | ||
public static class ReqCreateDockerDto { | ||
@Schema(title = "도커 registry 버전 지원(false: v2 지원)", required = true) | ||
@NotNull | ||
private Boolean v1Enabled; | ||
|
||
@Schema(title = "도커 클라이언트가 레포지토리에 접근할 때 기본 인증 사용 여부", required = true) | ||
@NotNull | ||
private Boolean forceBasicAuth; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 http 포트") | ||
private Integer httpPort; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 https 포트") | ||
private Integer httpsPort; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 서브도메인") | ||
private String subdomain; | ||
} | ||
} | ||
|
||
@Getter | ||
public static class ReqUpdateRepositoryDto { | ||
@Schema(title = "레포지토리 이름", required = true) | ||
@JsonIgnore | ||
private String name; | ||
|
||
@Schema(title = "레포지토리 사용자 접근 가능 여부", required = true) | ||
@NotNull | ||
private Boolean online; | ||
|
||
@Valid | ||
private ReqUpdateStorageDto storage; | ||
|
||
@Valid | ||
private ReqUpdateDockerDto docker; | ||
|
||
@Getter | ||
public static class ReqUpdateStorageDto { | ||
@Schema(title = "아티팩트를 저장하는 물리적 저장소 이름", required = true, example = "default") | ||
@JsonIgnore | ||
private String blobStoreName; | ||
|
||
@Schema(title = "저장되는 아티팩트 유형 일치 여부 검증", required = true) | ||
@NotNull | ||
private Boolean strictContentTypeValidation; | ||
|
||
@Schema(title = "레포지토리 읽기/쓰기 설정", required = true, example = "allow, allow_once, read_only") | ||
@NotBlank | ||
private String writePolicy; | ||
} | ||
|
||
@Getter | ||
public static class ReqUpdateDockerDto { | ||
@Schema(title = "도커 registry 버전 지원(false: v2 지원)", required = true) | ||
@NotNull | ||
private Boolean v1Enabled; | ||
|
||
@Schema(title = "도커 클라이언트가 레포지토리에 접근할 때 기본 인증 사용 여부", required = true) | ||
@NotNull | ||
private Boolean forceBasicAuth; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 http 포트") | ||
private Integer httpPort; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 https 포트") | ||
private Integer httpsPort; | ||
|
||
@Schema(title = "도커 레포지토리에 접근할 때 사용할 서브도메인") | ||
private String subdomain; | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
src/main/java/kr/co/mcmp/exception/NexusClientException.java
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,35 @@ | ||
package kr.co.mcmp.exception; | ||
|
||
import kr.co.mcmp.response.ResponseCode; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class NexusClientException extends RuntimeException { | ||
|
||
private static final long serialVersionUID = -7883846160384968138L; | ||
|
||
ResponseCode responseCode = ResponseCode.NEXUS_CLIENT_ERROR; | ||
private String detail; | ||
|
||
public NexusClientException() { | ||
this(ResponseCode.NEXUS_CLIENT_ERROR); | ||
} | ||
|
||
public NexusClientException(ResponseCode responseCode) { | ||
this.responseCode = responseCode; | ||
} | ||
|
||
public NexusClientException(ResponseCode responseCode, String detail) { | ||
this.responseCode = responseCode; | ||
this.detail = detail; | ||
} | ||
|
||
public NexusClientException(String detail) { | ||
this.detail = detail; | ||
} | ||
|
||
public NexusClientException(Throwable cause) { | ||
super(cause); | ||
this.detail = cause.getMessage(); | ||
} | ||
} |
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.