Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Op 7653 #52

Merged
merged 7 commits into from
Oct 7, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ class AuthConfig {
.antMatchers(HttpMethod.GET,'/visibilityservice/v2/approvalGateInstances/{id}/status').permitAll()
.antMatchers(HttpMethod.GET,'/visibilityservice/v1/approvalGateInstances/{id}/status').permitAll()
.antMatchers(HttpMethod.POST,'/oes/echo').permitAll()
.antMatchers(HttpMethod.POST,'/oes/echo/').permitAll()
.antMatchers(HttpMethod.POST,'/auditservice/v1/echo/events/data').permitAll()
.antMatchers(HttpMethod.POST,'/auditservice/v1/echo/events/data/').permitAll()
.antMatchers(HttpMethod.GET,'/autopilot/mgmt/**').permitAll()
.antMatchers('/plugins/deck/**').permitAll()
.antMatchers(HttpMethod.POST, '/webhooks/**').permitAll()
Expand Down Expand Up @@ -180,6 +183,9 @@ class AuthConfig {
.antMatchers(HttpMethod.GET,'/visibilityservice/v2/approvalGateInstances/{id}/status').permitAll()
.antMatchers(HttpMethod.GET,'/visibilityservice/v1/approvalGateInstances/{id}/status').permitAll()
.antMatchers(HttpMethod.POST,'/oes/echo').permitAll()
.antMatchers(HttpMethod.POST,'/oes/echo/').permitAll()
.antMatchers(HttpMethod.POST,'/auditservice/v1/echo/events/data').permitAll()
.antMatchers(HttpMethod.POST,'/auditservice/v1/echo/events/data/').permitAll()
.antMatchers(HttpMethod.GET,'/autopilot/mgmt/**').permitAll()
.antMatchers('/**/favicon.ico').permitAll()
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import com.netflix.spinnaker.kork.web.selector.ServiceSelector
import com.netflix.spinnaker.okhttp.OkHttp3MetricsInterceptor
import com.netflix.spinnaker.okhttp.OkHttpClientConfigurationProperties
import com.opsmx.spinnaker.gate.services.OpsmxAuditClientService
import com.opsmx.spinnaker.gate.services.OpsmxAuditService
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import okhttp3.OkHttpClient
Expand Down Expand Up @@ -266,6 +267,12 @@ class GateConfig extends RedisHttpSessionConfiguration {
createClient "auditclient", OpsmxAuditClientService, okHttpClient
}

@Bean
@ConditionalOnProperty("services.auditservice.enabled")
OpsmxAuditService opsmxAuditService(OkHttpClient okHttpClient) {
createClient "auditservice", OpsmxAuditService, okHttpClient
}

@Bean
@ConditionalOnProperty("services.keel.enabled")
KeelService keelService(OkHttpClientProvider clientProvider, OkHttpClient okHttpClient) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2021 OpsMx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.opsmx.spinnaker.gate.controllers

import com.opsmx.spinnaker.gate.services.OpsmxAuditService
import groovy.util.logging.Slf4j
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RestController

@Slf4j
@RestController
@RequestMapping("/auditservice")
@ConditionalOnExpression('${services.auditservice.enabled:false}')
class OpsmxAuditServiceController {

@Autowired
OpsmxAuditService opsmxAuditService

@ApiOperation(value = "Endpoint for audit rest services")
@RequestMapping(value = "/{version}/{type}/{source}/{source1}", method = RequestMethod.POST)
Object postAuditService1(@PathVariable("version") String version,
@PathVariable("type") String type,
@PathVariable("source") String source,
@PathVariable("source1") String source1,
@RequestBody(required = false) Object data) {

return opsmxAuditService.postAuditService1(version, type, source, source1, data)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2021 OpsMx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.opsmx.spinnaker.gate.services

import retrofit.http.Body
import retrofit.http.POST
import retrofit.http.Path

interface OpsmxAuditService {

@POST("/auditservice/{version}/{type}/{source}/{source1}")
Object postAuditService1(@Path('version') String version,
@Path('type') String type,
@Path('source') String source,
@Path('source1') String source1,
@Body Object data)

}